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

📄 enumsession.aspx

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



<script runat=server>

	Hashtable shoppingCart;


	class ShoppingCartItem
	{

		string _productName;
		int _quantityOrdered;

		 public  override int GetHashCode()
		{
			return 1;
		}
	}
	protected void Page_Load( object sender, EventArgs e )
	{

		ShoppingCartItem ci = new ShoppingCartItem();

		Session["value1"] = "Wrox";
		Session["value2"] = "Press";

		Response.Write(Session[0]);

		foreach( string s in Session )
		{
			Response.Write( "<BR>" + s);
		}

		Response.Write( "<HR>");

		Hashtable ourSession;

		// Case sensitive hashtable
		ourSession = new Hashtable();

		// Case insensitive hashtable

		ourSession = new Hashtable( CaseInsensitiveHashCodeProvider.Default,
									CaseInsensitiveComparer.Default	 );

		ourSession["value1"] = "Wrox";
		ourSession["value2"] = "Press";


		ourSession[ci] = "fred";
		string value;


		value = (string) ourSession["value1"];
		value = (string) ourSession["value2"];

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


		if ( ourSession["Value1"] != null )
		{
			Response.Write("<P>entry found");
		}


		int hashcode;
		string name = "Richard";
		

		hashcode = name.GetHashCode();	
		Response.Write( "Hash code is " + hashcode );
		

		StringDictionary names;
		string surname;

		names = new StringDictionary();
		names["richard"] = "anderson";
		names["alex"] = "homer";

		surname = names["alex"];

		Response.Write("The surname for alex is " + surname );

	
		

	}

</script>

⌨️ 快捷键说明

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