If I have a class with a lot of properties and I would like to create a constructor with all these properties I have to type a lot. Is there a smarter way in C# 4.0 to do this?
class MyClass {
public string A{get;set;}
public string B{get;set;}
public string C{get;set;}
public string D{get;set;}
public string E{get;set;}
public string F{get;set;}
public string G{get;set;}
//and so on...
public MyClass(string a, string b, string c /*and so on...*/)
{
this.A = a;
this.B = b;
this.C = c;
//...
}
}
I would like to force the user to create an object with all of the properties.