default.aspx.vb

来自「對c#初學者參考..為課題asp.net 2.0教材代碼」· VB 代码 · 共 35 行

VB
35
字号
Imports System
Imports System.Collections

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, _
            ByVal e As System.EventArgs) Handles Me.Load

        Dim scott As New Person("Scott", "Hanselman")
        Dim bill As New Person("Bill", "Evjen")
        Dim srini As New Person("Srinivasa", "Sivakumar")

        Dim peopleHashtable As New Hashtable()
        peopleHashtable.Add("sh", scott)
        peopleHashtable.Add("be", bill)
        peopleHashtable.Add("ss", srini)

        Dim found As Person = CType(peopleHashtable("sh"), Person)
        Response.Write(found.FullName & "<BR/>")
        found = CType(peopleHashtable("be"), Person)
        Response.Write(found.FullName & "<BR/>")
        found = CType(peopleHashtable("sh"), Person)
        Response.Write(found.FullName & "<BR/>")

        For Each s As String In peopleHashtable.Keys
            Response.Write(s & "<BR/>")
        Next

        For Each p As Person In peopleHashtable.Values
            Response.Write(p.FullName & "<BR/>")
        Next
    End Sub
End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?