Get Number of Objects Returned By CultureInfo.GetCultures Method ?

  • Thread starter Thread starter clintonG
  • Start date Start date
C

clintonG

I need help learning how to get the number of objects that are
returned from the CultureInfo.GetCultures method which
returns an array of objects.

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET (e-mail address removed)
URL http://www.metromilwaukee.com/clintongallagher/
 
Array.GetUpperBound(0) +1 or
Array.GetLength(0)
both will return the length of the first element of the array.
HTH
JB
 
Creating the object array...

foreach( CultureInfo ci in
CultureInfo.GetCultures( CultureTypes.AllCultures ) )
{
int cultureCount = Array.GetLength(ci);
}

But I'm using the Array.GetLength method wrong. As shown causes an error.

<%= Clinton Gallagher
 
public int GetCultureInfoCount()
{
CultureInfo[] CIA = CultureInfo.GetCultures(CultureTypes.AllCultures);
return CIA.GetLength(0);
}

HTH
JB
 
Much better. Thank you.

<%= Clinton Gallagher

John Baro said:
public int GetCultureInfoCount()
{
CultureInfo[] CIA = CultureInfo.GetCultures(CultureTypes.AllCultures);
return CIA.GetLength(0);
}

HTH
JB

Creating the object array...

foreach( CultureInfo ci in
CultureInfo.GetCultures( CultureTypes.AllCultures ) )
{
int cultureCount = Array.GetLength(ci);
}

But I'm using the Array.GetLength method wrong. As shown causes an error.

<%= Clinton Gallagher
 
Back
Top