Reputation: 2084
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?
Upvotes: 0
Views: 436
Reputation: 68400
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.
Upvotes: 1
Reputation: 38130
Yes. The compiler needs to know so that it can check the type when you try to set the property.
Upvotes: 4