newtelligence.DasBlog.Util.WindowsTimeZoneCollection.Add C# (CSharp) Method

Add() public method

Adds an instance of type WindowsTimeZone to the end of this WindowsTimeZoneCollection.
public Add ( WindowsTimeZone value ) : void
value WindowsTimeZone /// The WindowsTimeZone to be added to the end of this WindowsTimeZoneCollection. ///
return void
        public virtual void Add(WindowsTimeZone value)
        {
            this.List.Add(value);
        }

Usage Example

Exemplo n.º 1
0
        private static WindowsTimeZoneCollection LoadTimeZonesFromRegistry()
        {
            WindowsTimeZoneCollection tzs = new WindowsTimeZoneCollection();

            RegistryKey timeZoneListKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", false);

            string[] timeZoneKeyNames = timeZoneListKey.GetSubKeyNames();
            foreach (string timeZoneKeyName in timeZoneKeyNames)
            {
                RegistryKey     timeZoneKey     = timeZoneListKey.OpenSubKey(timeZoneKeyName);
                WindowsTimeZone windowsTimeZone =
                    new WindowsTimeZone(
                        timeZoneKey.GetValue("Display") as string,
                        timeZoneKey.GetValue("Dlt") as string,
                        timeZoneKey.GetValue("Std") as string,
                        (int)timeZoneKey.GetValue("Index"),
                        timeZoneKey.GetValue("TZI") as byte[]);

                tzs.Add(windowsTimeZone);
            }
            tzs.SortByTimeZoneBias();
            return(tzs);
        }
All Usage Examples Of newtelligence.DasBlog.Util.WindowsTimeZoneCollection::Add