Top "Automatic-properties" questions

What is the best way to give a C# auto-property an initial value?

How do you give a C# auto-property an initial value? I either use the constructor, or revert to the old …

c# constructor getter setter automatic-properties
Initializing C# auto-properties

I'm used to writing classes like this: public class foo { private string mBar = "bar"; public string Bar { get { return mBar; } …

c# initialization automatic-properties
C# Custom getter/setter without private variable

I learned c# recently, so when I learned to write properties, I was taught to do it like this: public …

c# coding-style accessor automatic-properties
What are Automatic Properties in C# and what is their purpose?

Could someone provide a very simple explanation of Automatic Properties in C#, their purpose, and maybe some examples? Try to …

c# .net syntax properties automatic-properties
Difference between Property and Field in C# 3.0+

I realize that it seems to be a duplicate of What is the difference between a Field and a Property …

c# properties c#-3.0 field automatic-properties
Public Fields versus Automatic Properties

We're often told we should protect encapsulation by making getter and setter methods (properties in C#) for class fields, instead …

c# class properties field automatic-properties
C# automatic property deserialization of JSON

I need to deserialize some JavaScript object represented in JSON to an appropriate C# class. Given the nice features of …

c# .net json serialization automatic-properties
C# Lazy Loaded Automatic Properties

In C#, Is there a way to turn an automatic property into a lazy loaded automatic property with a specified …

c# automatic-properties
C# 3.0 auto-properties — useful or not?

Note: This was posted when I was starting out C#. With 2014 knowledge, I can truly say that auto-properties are among …

c# .net automatic-properties
C# Automatic Properties - Why Do I Have To Write "get; set;"?

If both get and set are compulsory in C# automatic properties, why do I have to bother specifying "get; set;" …

c# c#-3.0 automatic-properties