【发布时间】:2015-07-18 13:57:59
【问题描述】:
这是我想要完成的 - 我希望这个类可以全局访问,我需要它的 6 个实例。所以基本上它应该是类似于 List[6] 的东西,它将在公共静态类中初始化......
class HH
{
public string hand { get; set; }
public string user { get; set; }
public int z { get; set; }
public int bb { get; set; }
public int eff { get; set; }
public int pos { get; set; }
public string pre { get; set; }
public string f { get; set; }
public string t { get; set; }
public string r { get; set; }
}
public static class tx
{
public static List<HH>[] HH = new List<HH>[6];
}
现在观察。这是错误的 - 但也许你明白我试图完成的事情。有人可以告诉我如何实现这一点,以便在我的代码中我可以访问类的元素并对其进行读写吗?
【问题讨论】:
-
你能写更多关于你的情况吗? (你想用它做什么以及为什么),这似乎仍然太少信息(至少对我来说)。
-
是的,你为什么需要这样做?
标签: list class generics static