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.Get Cultures(Cultur eTypes.AllAvail ableCultures);
System.Collecti ons.IEnumerator cultureEnumerat or =
allCultures.Get Enumerator();
bool found = false;
cultureEnumerat or.Reset();
while (cultureEnumera tor.MoveNext() && !found)
{
if (((CultureInfo) cultureEnumerat or.Current).ToS tring() ==
searchCultureID )
found = true;
}
"JezB" <je***********@ blueyonder.co.u k> wrote in message
news:eF******** ******@TK2MSFTN GP12.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.Get Cultures(Cultur eTypes.AllAvail ableCultures);
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******** ******@TK2MSFTN GP11.phx.gbl...
"JezB" <je***********@ blueyonder.co.u k> wrote in message
news:uJ******** ******@TK2MSFTN GP11.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