Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign properties in constructor parameters #4706

Closed
navidzehi opened this issue Apr 28, 2021 · 2 comments
Closed

Assign properties in constructor parameters #4706

navidzehi opened this issue Apr 28, 2021 · 2 comments

Comments

@navidzehi
Copy link

I have the following proposal :
Assign properties in constructor parameters .

public class Person {

   //   1. constructor without body:
   
  public Person (this.FirstName, this.LastName);

   //   2. with body :
   
  public Person (this.FirstName, string lastName){
     LastName  = lastName;
   }
   public string FirstName {get;set;}
   public string LastName {get;set;}
}

The closest alternative is using Records.

@ufcpp
Copy link

ufcpp commented Apr 28, 2021

#4024

@333fred
Copy link
Member

333fred commented Apr 28, 2021

Closing as a duplicate.

@333fred 333fred closed this as completed Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants