C#中实例一个自定义类的数组的做法

本文介绍了一个名为BarChartValue的类,该类用于创建柱状图表数据对象。提供了三种初始化BarChartValue数组的不同方式,并提及了通过Render方法渲染这些数据的方法。

/类
public class BarChartValue
{
    public BarChartValue()
    {

    }
    public BarChartValue(string MyName, int Myvalue)
    {
        Name = MyName;
        MValue = Myvalue;
    }
    private string name;
    public string Name
    {
        get
        {
            return name;
        }
        set
        {
            name = value;
        }
    }

    private int mvalue;
    public int MValue
    {
        get
        {
            return mvalue;
        }
        set
        {
            mvalue = value;
        }
    }
}

1.
        BarChartValue[] BarChartValue ={
        new BarChartValue("第一个仓库",1),
        new BarChartValue("第一个仓库",2)
        };
2.

        BarChartValue[] BarChartValue= new BarChartValue[2];
        BarChartValue[0] = new mytest();
        BarChartValue[0].Name = "";
        BarChartValue[1] = new mytest();
        BarChartValue[1].Name = "";
3.
        for (int i = 0; i < 5; i++)
        {
            BarChartValue[i] = new BarChartValue();
            BarChartValue[i].Name = "";
        }

用法:
用方法 :
Render("BarChartValue);
方法:
public string Render(PieChartValue[] Mydata)

转载于:https://www.cnblogs.com/cuihongyu3503319/archive/2007/05/25/759687.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值