Hi,
If you have an object like this:
public class Foo
{
private int _id;
public int id
{
get { return _id; }
set { _id = value; }
}
private string _name;
public string name
{
get { return _name; }
set { _name = value; }
}
}
And you want to initialize id to -1 and name to String.Empty what is the best practice? (and why)
Doing:
private int _id = -1
Or
Setting _id = -1 and name = String.Empty in the constructor?
Kind regards,
sem