📄 default.aspx.vb
字号:
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 people As New ArrayList()
people.Add(scott)
people.Add(bill)
people.Add(srini)
Response.Write("Unsorted. We used foreach.<BR/>")
For Each p As Person In people
Response.Write(p.FullName & "<BR/>")
Next
Response.Write("Sort...<BR/>")
people.Sort()
Response.Write("Sorted. We used foreach.<BR/>")
For Each p As Person In people
Response.Write(p.FullName & "<BR/>")
Next
Dim scott2 As New Person("Scott", "Hanselman")
Dim indexOfScott2 As Integer = people.IndexOf(scott2)
Response.Write("Scott #2 is at " & indexOfScott2 & "<BR/>")
Dim indexOfEquivalentScott As Integer = people.BinarySearch(scott2)
Response.Write("An Equivalent Scott is at " & _
indexOfEquivalentScott & "<BR/>")
Response.Write("We used a for loop.<BR/>")
For i As Integer = 0 To people.Count - 1
Response.Write(CType(people(i), Person).FullName & "<BR/>")
Next
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -