struct 类型用法.

struct 类型是一种值类型,通常用来封装小型相关变量组,例如,矩形的坐标或库存商品的特征。下面的示例显示了一个简单的结构声明。

d.aspx

统计信息: <br /><br />
新闻数:<%= Sate.newsCount %><br />
产品数:<%= Sate.proCount %><br />
会员数:<%= Sate.memberCount %>


d.aspx.cs

protected Common.ResInfo Sate;
    protected void Page_Load(object sender, EventArgs e)
    {
        Sate.newsCount = 123240;
        Sate.proCount = 144441;
        Sate.memberCount = 222;
    }



aa.cs
public static class Common
{
    public struct ResInfo
    {
        public int newsCount;
        public int proCount;
        public int memberCount;
    }
}

原文地址:https://www.cnblogs.com/sontin/p/1929823.html