| |||||||||||
CultureInfo.GetCultures MethodSystem.Globalization Namespace CultureInfo Class Gets the list of supported cultures filtered by the specified CultureTypes. [ VB ] public Shared Function GetCultures ( _ ByVal types As CultureTypes _ ) As CultureInfo ( ) [ C# ] public static CultureInfo [ ] GetCultures ( CultureTypes types ); [ C++ ] public: static CultureInfo* GetCultures ( CultureTypes types ) [ ]; [ JScript ] static function GetCultures ( types : CultureTypes ) : CultureInfo [ ]; Parameters
Return ValueAn array of type CultureInfo that represents the supported cultures filtered by the specified CultureTypes values. The array of cultures is unsorted. Exceptions
RemarksSetting the types parameter to the SpecificCultures value returns all specific cultures. Setting types to the NeutralCultures value returns all neutral cultures and the invariant culture. Setting types to the AllCultures value returns all neutral and specific cultures, cultures installed in the Windows system, and custom cultures created by the user. ExampleThe folllowing example shows using GetCultures to fetch and print the names and currency formats of specific cultures.
By itself, the returned array of CultureInfo objects cannot be sorted, as the CultureInfo class does not implement the IComparable interface, which allow for type-specific comparing and sorting. However, sorting can still be done by first copying the string equivalent of each CultureInfo object in the array into a collection that supports sorting, such as an ArrayList, and then invoking the Sort method on the ArrayList. The below example illustrates how you can present the list of supported cultures sorted by culture name. CultureInfo [ ] cultures = CultureInfo.GetCultures ( CultureTypes.SpecificCultures );
ArrayList strCultures = new ArrayList ( );
foreach ( CultureInfo culture in cultures ) {
strCultures.Add ( culture.ToString ( ) );
}
strCultures.Sort ( );
See AlsoCultureInfo Members CultureTypes |
| ||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme