What is the syntax in C# for creating setters and getters?

Posted by Sergio Tapia on Stack Overflow See other posts from Stack Overflow or by Sergio Tapia
Published on 2010-05-09T16:16:56Z Indexed on 2010/05/09 16:28 UTC
Read the original article Hit count: 223

Filed under:
|
|

I'm familiar with this new syntax sugar:

public string Name { get; set; }

But what if I was the setter of that variable to have some sort of checking. For example, I want to convert the entire string that is supposed to be Set to all lowercases.

public string Name
{
   get;
   set 
   {
      ????
   }
}

© Stack Overflow or respective owner

Related posts about c#3.0

Related posts about set