I'm using the enumerator method at the moment, but I want to make sure it's
the most efficient way
string searchCultureID = "en-GB";
CultureInfo[] allCultures =
CultureInfo.GetCultures(CultureTypes.AllAvailableC ultures);
System.Collections.IEnumerator cultureEnumerator =
allCultures.GetEnumerator();
bool found = false;
cultureEnumerator.Reset();
while (cultureEnumerator.MoveNext() && !found)
{
if (((CultureInfo)cultureEnumerator.Current).ToString () ==
searchCultureID)
found = true;
}
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:eF**************@TK2MSFTNGP12.phx.gbl...
I'm trying to test whether a given culture identifier (eg. "En-GB") is in
the list of supported cultures, which I obtain using
CultureInfo[] allCultures =
CultureInfo.GetCultures(CultureTypes.AllAvailableC ultures);
This returns an array of CultureInfo's, which I want to scan for a given
identifier.
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:Of**************@TK2MSFTNGP11.phx.gbl...
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:uJ**************@TK2MSFTNGP11.phx.gbl... What is the most efficient way to scan an array for a match ? I could just iterate directly through it comparing each array entry with what I am
looking for, I could use an enumerator to do the same thing (though I dont know if this is better), I could convert the array to some other structure which makes direct lookup possible (if I want to do the same thing
many times), or maybe some other entirely different approach is better. Any
ideas?
That would depend on the type of data and the nature of the lookup.
Provide some details and maybe we can help you further.
Hans Kesting