Skip to content

Feature Request: Light weight property declaration #224

Description

@jonparker

Sometimes a class has many properties with the same type.
For example

public class Person
{
  public string FirstName { get;set; }
  public string LastName { get;set; }
  public string EmailAddress { get;set; }
}

Would become:

public class Person
{
  public string FirstName, LastName, EmailAddress { get;set; }
}

Activity

  1. alanfo commented on Feb 8, 2015

    @alanfo

    I suppose there's some logic to your proposal as one can, of course, already, declare multiple fields on the same line.

    private string s, t, u;

    However, I'm not sure it sits too well with getter-only, mixed accessibility or initialized auto-properties as it might get rather confusing if all the properties were not of exactly the same kind:

    public string FirstName = "John", LastName = "Doe" { get;set; }, EmailAddress { get; } = "JohnDoe@Anywhere.com";

  2. somebody1234 commented on Apr 27, 2015

    @somebody1234

    Wouldn't you just have those on a separate line? Like:

    public string FirstName = "John", LastName = "Doe" { get; set; }
    public string EmailAddress { get; } = "JohnDoe@Anywhere.com";
    
  3. gafter commented on Mar 20, 2017

    @gafter
    Member

    We are now taking language feature discussion on https://github.com/dotnet/csharplang for C# specific issues, https://github.com/dotnet/vblang for VB-specific features, and https://github.com/dotnet/csharplang for features that affect both languages.

  4. added a commit that references this issue on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions