I often find I am writing a class similar to the following (but with a varying number of members, types of members, etc). Is it possible to do this automatically, easily, and for free?
So I would like to provide the parameters "Foo", "int", "apples", "bool", "banana", "Bar", and "clementine" and have the rest of code generated for me.
public class Foo
{
public Foo(int apples, bool banana, Bar clementine)
{
m_Apples = apples;
m_Banana = banana;
m_Clementine = clementine;
}
public int Apples
{
get { return m_Apples; }
set { m_Apples = value; }
}
public bool Banana
{
get { return m_Banana; }
set { m_Banana = value; }
}
public Bar Clementine
{
get { return m_Clementine; }
set { m_Clementine = value; }
}
private int m_Apples;
private bool m_Banana;
private Bar m_Clementine;
}