struct类
枚举
public partial class admin_Add : System.Web.UI.Page
{
public struct Book
{ //声明一个结构体,里面几乎可以放所有类型
public int price;
public string title;
public string anthor;
public int ok;
}
enum ee
{//声明枚举类型
ss=22,mm=25,kk=22,//中间用逗号
}
enum ff {ss,mm,tt};//另一种申明方式
protected void Page_Load(object sender, EventArgs e)
{
Book bk=new Book();//声明
bk.price = 31;
bk.title = "教育技术学";
bk.anthor = "何克抗";
bk.ok = 0;
Label1.Text = bk.price.ToString();
Label2.Text = bk.title.ToString();
Label3.Text = bk.anthor.ToString();
Label4.Text = Convert.ToInt32(ee.ss).ToString();//枚举类型需要转换
//做判断
if (bk.ok == 1)
{
Response.Write("很好");
}
else
{
Response.Write("不喜欢");
}
}
}