Determining count of array (1 dim) elements (words within a string) - which is better approach to use: .GetLength(0) or .Length ? Is one approach better than the other, or only marginally?
See code snippet below:
See code snippet below:
Code:
string[] MyCheck = mystring.TrimStart().Split(' ');
int MyItemsCnt = 0;
MyItemsCnt = MyCheck.[B]GetLength(0)[/B] ;
// [u]or[/u] ???
MyItemsCnt = MyCheck.[B]Length[/B] ;
if ( MyItemsCnt > 50 )
{
MyItemsCnt = 50; // caps words in string to 50 max.
}
... and so on