0
 public class DeviceInformation
{
    private Dictionary<string, string> m_parameters = new Dictionary<string, string>();

    public string Class { get; set; }
    public string Model { get; set; }
    public string SerialNumber { get; set; }

    public DeviceUID UID { get; set; }

    public IDictionary<string, string> Parameters 
    {
        get { return m_parameters; }
    }
}

The class does not even define private data such as Class, Model, SerialNumber. What are the accessor function for? I am a c++ user and really confused by this syntax.

Kevin T
  • 33
  • 1
  • 4

2 Answers2

2

The compiler creates a private variable and makes the getter and setter for you.

anthonybell
  • 5,004
  • 7
  • 38
  • 55
0

Those are what we call in the C# world 'Properties' while you -can- use them as accessors for existing private or public data members, as you have them they exist as full fledged data members.

Entropy
  • 64
  • 1
  • 4