Hi all,
If I want to say history list was null matrix [][] be 0, How could be written?
the code blew gives an error.
List
- > history = new List
- >() ;
int [][] matrix= new int[5][];
if (history[y].Contains("192.168.2.160", StringComparer.OrdinalIgnoreCase))
matrix[x+4][y] = 1;
else if (history[y].Contains==null)
matrix[x][y] = 0;
thanks

VulpesRank #55 · 29.2K reputationPosted Aug 26, 2013, 2:32 AM EDT
This line on its own is not sufficient - it just tells the compiler than there are 5 single dimensional arrays within the jagged array.
VulpesRank #55 · 29.2K reputationPosted Aug 25, 2013, 9:53 AM EDT
However, if you want to test that the List
diamond diamond131 reputationPosted Aug 25, 2013, 10:08 AM EDT
I used history[].count<=0
this time is run but the command of if gives an exception:
check to determined if the object is null before calling the method
VulpesRank #55 · 29.2K reputationPosted Aug 25, 2013, 10:45 AM EDT
else if (history[y] == null || history[y].Count == 0)
Note that it's not possible for a List
diamond diamond131 reputationPosted Aug 25, 2013, 12:28 PM EDT
But this time for matrix[x][y] = 0; gives an exception ??!!!
VulpesRank #55 · 29.2K reputationPosted Aug 25, 2013, 12:56 PM EDT
Have you initialized matrix[x] somewhere?
matrix[x] = new int[5]; // or whatever
diamond diamond131 reputationPosted Aug 25, 2013, 8:56 PM EDT
int [][] matrix= new int[5][];
The exception message is as same as already message
diamond diamond131 reputationPosted Aug 26, 2013, 2:39 AM EDT
I want to create matrix which has 5 rows and history.count columns.
for that as far as I know, it is sufficient to write, is it wrong?
Can you let me know how do I do for that?
diamond diamond131 reputationPosted Aug 26, 2013, 2:53 AM EDT
I correct it with this style
int [,] matrix=new int [5,1000]