/// <summary>Gets the list of supported cultures filtered by the specified <see cref="T:System.Globalization.CultureTypes" /> parameter.</summary>
/// <returns>An array of type <see cref="T:System.Globalization.CultureInfo" /> that contains the cultures specified by the <paramref name="types" /> parameter. The array of cultures is unsorted.</returns>
/// <param name="types">A bitwise combination of <see cref="T:System.Globalization.CultureTypes" /> values that filter the cultures to retrieve. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="types" /> specifies an invalid combination of <see cref="T:System.Globalization.CultureTypes" /> values.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
public static CultureInfo[] GetCultures(CultureTypes types)
{
bool flag = (types & CultureTypes.NeutralCultures) != (CultureTypes)0;
bool specific = (types & CultureTypes.SpecificCultures) != (CultureTypes)0;
bool installed = (types & CultureTypes.InstalledWin32Cultures) != (CultureTypes)0;
CultureInfo[] array = CultureInfo.internal_get_cultures(flag, specific, installed);
if (flag && array.Length > 0 && array[0] == null)
{
array[0] = (CultureInfo)CultureInfo.InvariantCulture.Clone();
}
return(array);
}