Hash table: Date key and string value (C#) : Hashtable « Collections « ASP.Net






Hash table: Date key and string value (C#)

<%@ Page Language="C#" %>
<script runat="server">


void Page_Load(){
    Hashtable myHashtable = new Hashtable();

    myHashtable[Convert.ToDateTime("1/1/2005")] = "Event on January 1st 2005";


    string CountryName;
    CountryName = Convert.ToString(myHashtable[Convert.ToDateTime("1/1/2005")]);   
    lblOut.Text = CountryName;

} 


</script>
<html>
    <head>
    </head>
    <body>
        <form runat="server">
        <asp:Label runat="server" ID = "lblOut">Label</asp:Label>
        </form>
    </body>
</html>

           
       








Related examples in the same category

1.For Each loop through a Hashtable (VB.net)
2.Define and use Hashtable (VB.net)
3.For each statement for Hashtable (C#)
4.Hashtable: int key and string value (C#)
5.Hash table Key is case sensitive (C#)
6.Hashtable: string key and string value (C#)