public Attribute this[int index],this[int 怎么用?

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/18 09:18:18
public Attribute this[int index],this[int 怎么用?
x?K@ƿʍ Hscr.{SPI]D\Z860j{%:qy8;v1?ENpdώV|r9,nvm?6rb|{(/K-:dLP{ B$$0}PHcQ}1VKv m-( XaרW.fs‘I1M䲈׊$,RR,%![|6_ȚWW) +:q]պEjgȼ*eu!Hf[*ҩ 

public Attribute this[int index],this[int 怎么用?
public Attribute this[int index],this[int
怎么用?

public Attribute this[int index],this[int 怎么用?
对象自身索引的意思.
public class MyCollection
{
private List m_list;
public MyCollection()
{
m_list = new List();
}
public void Add(Attribute item)
{
m_list.Add(item);
}
public Attribute this[int index]
{
get { return m_list[index]; }
}
static void Main()
{
MyCollection mc = new MyCollection();
mc.Add(new ObsoleteAttribute());
mc.Add(new WebMethodAttribute());
Attribute atti = mc[1]; //WebMethodAttribute
}
}