学习asp.net 遇到的一个小问题,路过的朋友帮忙看看。
==代码如下=======
public partial class t1 : System.Web.UI.Page
{
public class User
{
private static int count;
private static string name;
public User()
{
count++;
}
static User()
{
count = 0;
name = "初始值 ";
}
public string Nmae
{
get
{ return name; }
set
{ name = value; }
}
public static string OneName
{
get
{ return name; }
}
public static int Count
{
get
{ return count;}
}
public static string Mn(string name)
{
return "个对象,共享方法后的结果是: " + name;
}
}
protected void Page_Load(object sender, EventArgs e)
{
Response.Write( "目前是: "+User.Count+ "个对象,初始名字是: "+User.OneName);
User u1=new User();