I try to add multiple data type of data in one list.
public class DataList
{
public List<int> DataOne=new List<int>();
public int DataTwo;
public double DataThree;
public List<int> DataFour = new List<int>();
public DataList(List<int> DataOne, int DataTwo, double DataThree, List<int> DataFour)
{
this.DataOne=DataOne;
this.DataTwo=DataTwo;
this.DataThree=DataThree;
this.DataFour=DataFour;
}
}
public List<DataList> AddAllData = new List<final>();
AddAllData.Add(new DataList( ????? )); //<-Could add multiple data by one code?
thank you Guy solve this.
But for more: if
public class One
{
public List<int> OneLise=new List<int>();
public List<double> TwoLise=new List<int>();
public One(List<int> OneLise, int TwoLise)
{
this.OneLise=OneLise;
this.TwoLise=TwoLise;
}
}
public class DataList
{
public List<One> DataOne=new List<One>();
public int DataTwo;
public DataList(List<One> DataOne, int DataTwo)
{
this.DataOne=DataOne;
this.DataTwo=DataTwo;
}
}
AddAllData.Add(new DataList( ????? )); //<-Could add multiple data by one code?
e.g:something like that
AddAllData.Add(new DataList(DataOne.Add(5,2.3), 1, 5.3, DataFour.Add(4,2.65)));
I know one of method:
public List<one> one = new List<one>();
one.Add(5,2.3);
public List<one> four = new List<one>();
four.Add(4,2.65);
AddAllData.Add(new DataList(one, 1, 5.3, four));
but it need more code to add data into list.
if AddAllData is more that 1000 element. it is waste time to add data
How to add multiple data type of data into one list by one code?