Skip to content

Instantly share code, notes, and snippets.

@ecanuto
Created April 16, 2018 10:01
Show Gist options
  • Save ecanuto/53a65bc4d871a328649d125dfb27edd8 to your computer and use it in GitHub Desktop.
Save ecanuto/53a65bc4d871a328649d125dfb27edd8 to your computer and use it in GitHub Desktop.
Class property in C#
public class User {
private String name;
public string Name
{
get { return name; }
set { name = value; }
}
}
User user = new User();
user.name = "Joe Doe";
@ecanuto
Copy link
Author

ecanuto commented Apr 16, 2018

Ou ainda, a versão curta:

public class User {
    public string User { get; set; }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment