Q:

C# program to get the hash code of the time zone (TimeZoneInfo.GetHashCode() Method)

belongs to collection: C# TimeZoneInfo Class Programs

0

Syntax:

    int TimeZoneInfo.GetHashCode();

Parameter(s):

  • None

Return value:

This method returns an integer value that represents the hash code of the timezone.

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

The source code to get the hash code of the time zone is given below. The given program is compiled and executed successfully.

using System;
using System.Globalization;
using System.Collections.ObjectModel;

class TimeZoneInfoDemo
{
    //Entry point of Program
    static public void Main()
    {
        //Create object of date and time format.
        DateTimeFormatInfo datTimeFormat;

        //Create collection for timezones
        ReadOnlyCollection<TimeZoneInfo> ListOftimeZones;

        datTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat;
        ListOftimeZones = TimeZoneInfo.GetSystemTimeZones();

        Console.WriteLine("HashCodes: ");
        foreach (TimeZoneInfo time_zone in ListOftimeZones)
        {
            Console.WriteLine("\t"+time_zone.GetHashCode());
        }
    }
}

Output:

HashCodes:
        -514555984
        -758128916
        -1369885288
        1929871915
        -20620119
        1966587549
        -1011079097
        -1549238612
        867061357
        -2030645691
        -1472553907
        -774670651
        398800922
        -51503002
        1575136615
        -1920434229
        -1759550415
        781531414
        1688170723
        277435212
        780897488
        672784620
        -1290608544
        1061339055
        1409949984
        849007863
        -1010907336
        -91072651
        1857440091
        1289301972
        524845130
        -985979243
        -884914970
        1243702734
        -2134877238
        417657061
        -1072506847
        1951788994
        587654972
        1596262695
        1796499939
        1141185203
        -152181505
        137358981
        -1896308101
        -1437804775
        203046616
        567328507
        390533655
        2030831431
        -2011598098
        -581402749
        -72981115
        1022731794
        2018412928
        271408839
        457374418
        -1818159890
        1602929463
        858250651
        -74019787
        -1714669205
        153346398
        -270438407
        -2049351688
        296234527
        -1887523373
        199744320
        -851594192
        1782768786
        1141291926
        779965156
        -1853844139
        -981867726
        -963623640
        -1152086148
        2058205788
        1859384373
        -846996468
        -409381159
        -1265531735
        -873538331
        13992051
        1703400787
        556097360
        -1534558847
        -1503639322
        2053458808
        -1078326823
        -1759089867
        1773130869
Press any key to continue . . .

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# TimeZoneInfo Class Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C# program to get a sorted collection of all the t... >>
<< C# program to determine whether two TimeZoneInfo o...