var movieNext = new string[,]
{
{ "superhero", "action", "waltdisney", "bat"},
{"superhero", "action", "marvel",""},
{"history", "action", "malay", "" },
{"malay", "novel", "", ""},
{"history", "bat", "", ""}
};
The above code is a multidimensional array, which stores a sequence of movie’s keyword. Is there a way to implement this without having to put the blank strings in the array initialization?
For example you can see in the above code, I have to put the blank string “” to fill up the array.
You can consider C# jagged array (though they are different from multi-dimensional arrays).
If you want to stick with multi-dimensional arrays, you have to initialize the values individually. If you don’t provide any string value for any of the index (i,j) by default it will be null.