搞了半天也搞不出,看哪位大哥帮帮忙了,我只要一获取arraylist数组values的值就得到了类名PositionData了,怎样获取下面代码中values.Add(new PositionData("Microsoft", "Msft", "150 共享"))的数据呢
代码如下:
class Program
{
static void Main(string[] args)
{
ArrayList values = new ArrayList();
values.Add(new PositionData("Microsoft", "Msft", "150 共享"));
values.Add(new PositionData("Intel", "Intc", "25 共享"));
values.Add(new PositionData("Dell", "Dell", "115 共享");
Console.WriteLine(这里到底应该怎么写呢?呵呵 望不吝赐教!)
}
}
public class PositionData
{
private string name;
private string ticker;
private string shares;
public PositionData()
{
}
public PositionData(string name, string ticker, string shares)
{
this.name = name;
this.ticker = ticker;
this.shares = shares;
}
public string Name
{
get
{
return name;
}
}
public string Ticker
{
get
{
return ticker;
}
}
public string Shares
{
get
{
return shares;
}
}
}