⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hashcodes.aspx

📁 This is a book about vb.you could learn this from this book
💻 ASPX
字号:
<%@Page Language="vb"%>
<%@ Import Namespace="System.IO" %>

<script runat=server>

	Dim shoppingCart As Hashtable

		Class Product
		
			Public Overrides Function GetHashCode() As Integer
			
				Return 1
			
			End Function


			Public overrides Function Equals( c As Object ) As Boolean
			
				Return True
			
			End Function

		End Class


	Class ShoppingCartItem
	
		Dim _productName As String
		Dim _quantityOrdered As Integer

'		public  override int GetHashCode()
'		{
'			return 1;
'		}

		Public Overrides Function Equals( x As Object ) As Boolean
		
			Return True
		
		End Sub
		
	End Class
	
	
	Protected Sub Page_Load( sender As Object, e As EventArgs)

		'Dim c1 As New ShoppingCartItem()
		'Dim c2 As New ShoppingCartItem()

		'Dim ourSession As New Hashtable()

		'ourSession(c1) = "Wrox"
		'ourSession(c2) = "Press"

		'Dim entry As DictionaryEntry 
		'For Each entry In ourSession
		'	Response.Write("<BR>Key:" & entry.Key & " Value:" & entry.Value )
		'Next

		'Session("key") = "value"
		'Response.Write("<P>value is " & Session("KEY") )

		'ourSession("key") = "value"
		'Response.Write("<P>value is " & ourSession("KEY") )


		Dim a As New Product()
		Dim b As New Product()

	
		Response.Write( a.GetHashCode() )
		Response.Write( "<BR>" )
		Response.Write( b.GetHashCode() )


		Dim Products As New Hashtable()

		Products(a) = a
		Products(b) = b

		Response.Write("<BR>")
		Response.Write( Products.Count )

	End Sub
	

</script>

⌨️ 快捷键说明

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