Just got to know about C# snippet. But i am unable to use them in my code. Help me out please, I am messed up with get set and how they work.
Here is my test class named "myclass"
namespace WindowsFormsApplication1
{
class myclass
{
public string getmessage(string givenName)
{
return "HB "+givenName;
}
private string bmessage;
public string MyProperty
{
get { return bmessage; }
set { bmessage = value; }
}
}
}
In button code from my form. I am unable to use these get set. It ll be great if someone clears that how can i use these get set. Moreover what is "MyProperty" here? I know it is not a method. What is its purpose? Thanks