Let's say you have a class
public class Person
{
public int PesronId{get;set;}
public string FirstName{get;set;}
public string LastName{get;set;}
public string Gender{get;set;}
}
Now we create the object p1
Person p1 = new Person();
Next, we have values from text fields that need to be assigned p1 for example.
p1.PersonId = textbox1.text;
p1.FirstName = textbox2.text;
p1.LastName = textbox3.text;
Is there a more efficient way to do this in Visual Studio 2010 with which I will get something like this
p1.PersonId =
p1.FirstName =
p1.LastName =
so I don’t need to manually enter the properties for p1.
Or is this an alternative syntax that I can use.
source
share