First of all i searched through the questions and I haven't found the thing I need , maybe it doesn't exist haha but i'll give it a shot.I am new to C# and I am coming from C++, got highschool experience.
In C++ I had Vector<int> T[];
so I could create a list with a size that it wasn't know; and make something like this and not wasting space; to be more exact
T[0][....];
T[1][...];
1 2 3 4 5
1 2 3
2 4 1 5
0 0 0 0 0 0
I am trying to do this in C# and It doesn't seem to work; I have tried this so far:
public class myints
{
public int x { get; set; }
}
public List<myints[]> T = new List<myints[]>();
T[i].Add(new myints() { x = i });
I wanna be able to add stuff and then use Count()
in a for
to see how many elemts I have in a T[i]
. like T[i].size()
... Is this possible?
the program says System.Array does not contain a definition for Add
>`.
– Lucas Trzesniewski Jan 04 '16 at 19:53> T = new List
– rakuens Jan 04 '16 at 20:23>(); - and using T[i].Add(j); under 2 fors, to add stuff and I'm getting a out of range() out of index?? error when I'm doing this at the T[i].Add(j); ... what do I do?