I want to add the below data into array in c# , but I dont know the size of the array. I have searched many questions, but all array's size in predefine.
I dont want to define the the size of the array as data will come from DB run-time.
so how can I add the below data into Array in C# ?
(Id : Value)
1 : 500 ,
2 : 700 ,
3 : 800 ,
4 : 900 ,
.
.
.
Upto no of records into DB.
I have the below code and want to add data to array like below code.
foreach (var LocationObj in Location)
{
StockList.Add(InventoryDTO.Id, InventoryDTO.Quantity);
}
Cant use dictionary, as key might be duplicate.
Want simple code of 2D List...
> my2DList = new List
– Tarec May 13 '14 at 10:14>();` and then fulfill it like this `my2DList.Add(new List())` or another way: `var internalList = new List()` and `my2DList.Add(internalList);`