default.aspx

来自「Professional ASP.NET source code」· ASPX 代码 · 共 35 行

ASPX
35
字号
<%@Page Language="C#" %>

<script runat="server">


class MyStringCollection : CollectionBase
{
	override protected void OnInsert(int index, object item)
	{
		if (item.GetType() != typeof(string))
			throw new ArgumentException("Collection only supports strings");
	}
}


</script>

<%

	IList names;

	names = new MyStringCollection();

	names.Add("Richard");
	names.Add("Alex");
	names.Add("Dave");

	// Uncomment next line to cause an exception
	//names.Add( 2002 );

	foreach (string name in names)
		Response.Write( name + "<BR />" );

%>

⌨️ 快捷键说明

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