simply said get; and set; are short versions for class design.
example:
public class test()
{
public string Name {get; set;}
}
so you can use:
test newobject = new test();
newobject.Name = "test1"; // this is the set
string test2 = newobject.Name; // this is the get
the long version
public class test()
{
private string name;
public void SetName (string newname)
{
name = newname;
}
public string GetName ()
{
return name;
}
}
so you must use:
test newobject = new test();
newobject.SetName("test1");
string test2 = newobject.GetName();
only a simple example.
|