Friday, April 8, 2011

How to get multidimensional length - of one axis

I have an array such as

 string[,] SSISVariableNameValue = new string[,] 
            {
            {"DestinationConfigDB","dest db"},
            {"DestinationServer","dest server"},
            {"SourceConfigDB","source db"},
            {"SourceServer","source server"},
            {"SSISConfigFilter","filter"}
            };

The .length property is listed as 10. How can i get the 'x' axis of this array..aside from dividing by 2?

From stackoverflow
  • An array has a Rank property to tell you the number of dimensions and a GetLength(int d) function to give you the size in a specific dimension. d = 0 .. Rank-1

    So you want SSISVariableNameValue.GetLength(0);

0 comments:

Post a Comment