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

📄 hashcodes.aspx

📁 东软内部材料(四)asp等相关的教学案例 
💻 ASPX
字号:
<%@Page Language="C#"%>
<%@ Import Namespace="System.IO" %>

<script runat=server>

	Hashtable shoppingCart;

		class Product
		{

			public override int GetHashCode()
			{
				return 1;
			}


			public override bool Equals( Object c )
			{
				return true;
			}

		};


	class ShoppingCartItem
	{


		string _productName;
		int _quantityOrdered;

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

		public override bool Equals( object x )
		{
			return true;
		}
	}
	protected void Page_Load( object sender, EventArgs e )
	{


		/*


		ShoppingCartItem c1 = new ShoppingCartItem();
		ShoppingCartItem c2 = new ShoppingCartItem();

		Hashtable ourSession;
		ourSession = new Hashtable();


		ourSession[c1] = "Wrox";
		ourSession[c2] = "Press";

		foreach( DictionaryEntry entry in ourSession )
		{
			Response.Write("<BR>Key:" + entry.Key + " Value:" + entry.Value );
		}


		Session["key"] = "value";
		Response.Write("<P>value is " + Session["KEY"] );

		ourSession["key"] = "value";
		Response.Write("<P>value is " + ourSession["KEY"] );


*/
		Product a = new Product();
		Product b = new Product();

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


		Hashtable Products = new Hashtable();

		Products[a] = a;
		Products[b] = b;

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


	}

</script>

⌨️ 快捷键说明

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