Very basic class

	public class DataGridData
	{
		public string Category { get; set; }
		public double Value1 { get; set; }
		public bool Value2 { get; set; }
	}
Using it
	DataGridData DataGridData1 = new DataGridData() { Category = "Cat0", Value1 = 1000, Value2 = true };
	//or like this
	DataGridData DataGridData2 = new DataGridData();
	DataGridData2.Category = "Cat2";
	DataGridData2.Value1 = 1002;
	DataGridData2.Value2 = true;
Using it for a list
public List<DataGridData> DataGridData1;

	DataGridData1 = new List<DataGridData>();
	DataGridData1.Add(new DataGridData() { Category = "Cat0", Value1 = 1000, Value2 = true });	//<<You can do this instead of creating a constructor
	DataGridData1.Add(new DataGridData() { Category = "Cat1", Value1 = 1001, Value2 = false });
	//or like this
	DataGridData1.Add(new DataGridData());
	DataGridData1[(DataGridData1.Count - 1)].Category = "Cat2";
	DataGridData1[(DataGridData1.Count - 1)].Value1 = 1002;
	DataGridData1[(DataGridData1.Count - 1)].Value2 = true;

Very basic class with a constructor

	public class DataGridData
	{
		public string Category { get; set; }
		public double Value1 { get; set; }
		public bool Value2 { get; set; }

		//----- CONSTRUCTOR -----
		public DataGridData (string Category, double Value1, bool Value2)
		{
			this.Category = Category;
			this.Value1 = Value1;
			this.Value2 = Value2;
		}
	}
Using it
	DataGridData1 = new List<DataGridData>();
	DataGridData1.Add(new DataGridData("Cat0", 1000, true));
	DataGridData1.Add(new DataGridData("Cat1", 1001, false));
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *