/// <summary> /// Constructs a TimeZone array out of TimeZoneInfo collection /// </summary> /// <param name="tzInfoCollection"></param> /// <returns></returns> private static TimeZone[] ConstructFromCollection(TimeZoneInfos tzInfoCollection) { TimeZone[] timeZones = new TimeZone[tzInfoCollection.Count]; int index = 0; foreach (TimeZoneInfo tzinfo in tzInfoCollection) { timeZones[index++] = new TimeZone(tzinfo); } return(timeZones); }
/// <summary> /// Returns all time zones with the specified bias. /// </summary> public static TimeZoneInfos GetTimeZoneInfos(int bias) { TimeZoneInfos results = new TimeZoneInfos(); foreach (TimeZoneInfo tzinfo in SystemTimeZoneInfos) { if (tzinfo.Bias == bias) { results.Add(tzinfo); } } if (results.Count == 0) { throw new System.ApplicationException("Unable to find time zones with bias '" + bias.ToString() + "'."); } return(results); }