0
public string Name { get { return name; } set { name = value; } }
i didnt get what "get" and "set" is. Are they methods or something else?
3 odpowiedzi
+ 2
That's a c# special mechanism for maintaining private field in a faster way inclusive way. It is little confuse with compare to other languages.
It just same as setting and getting private filed with public methods.
get, set are called accessors, if
private int a ; is field then you can set get as property like
public int A {
set { a= value;}
get { return a;}
}
Now you can access a value as object.A (return a value)
Or set by object.A=20. //set a=20
Here object is class object..
Next topics will clearly explain about this and It's feature... Continue reading...
Hope it helps..
+ 3
https://www.sololearn.com/learn/CSharp/2624/
sorry for the confusion
+ 1
Which language? Pls tag language..
Is that complete code..? Share the link possibly...
They are methods generally which are get the value or set values..