Q:

Proper Syntax for C# Properties

Per the MSDN documentation, the following syntax is used:
// A read-write instance property:
public string Name
{
    get { return name; }
    set { name = value; }
}

However, the following code is generated by VS2010 automatically for a new library class:
public string Name
{
    get
    {
        String s = (String)ViewState["Name"];
        return ((s == null) ? String.Empty : s);
    }

    set
    {
        ViewState["Name"] = value;
    }
}

When is it appropriate to use the ViewState syntax over the shorter example shown on MSDN?

A:

ViewState is a feature of ASP.Net server controls that persists information across postbacks.
For simple properties that aren't in a server control, you should use an auto-implemented property:
public string Name { get; set; }

