If there is only a set part in a Property, then is there any need to declare a return type? For example:
public string Email
{
set { email = value; }
}
In the above example is there any need of the word "string" after public?
If there is only a set part in a Property, then is there any need to declare a return type? For example:
public string Email
{
set { email = value; }
}
In the above example is there any need of the word "string" after public?
Yes. The compiler needs to know so that it can check the type when you try to set the property.
The simple answer is: It's not possible to have a property without a type
Think that value is of the type that you specified so it's not that it's not being used.