作者sweetjp6 (水饺)
看板C_Sharp
标题[问题] array的封装
时间Tue Jul 21 20:45:10 2015
想请问一个array封装的办法
Ex:
private Dictionary<string, string>[] xyz =
new Dictionary<string, string>[]
{
new Dictionary<string, string>(),
new Dictionary<string, string>(),
new Dictionary<strgin, string>()
}
public Dictionary<string, string>[] Xyz
{
get;
set;
}
请问get, set部分应该怎麽写才能够access到每个元素呢?
可能用法如下:
Dictionary<string, string> x1 = Xyz[0];
请各位不吝赐教, 谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 180.177.15.103
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_Sharp/M.1437482713.A.73F.html
1F:推 TameFoxx: Array是物件 好像很少在对物件作封装的耶 08/21 16:04