Retrieval of items from custom collection

后端 未结 4 972
失恋的感觉
失恋的感觉 2020-12-20 22:45

I have a following class

public class People
{
    public int id;
    public string nameHash;
    public string name;
}

I need to create a

4条回答
  •  北海茫月
    2020-12-20 23:02

    You have two choices here:

    1. Inherit from an existing collection type, as shown in other answers.
    2. Implement the System.Collections.IEnumerable or System.Collections.Generic.IEnumerable interface, which also means writing your own implementation of System.Collections.IEnumerator or System.Collections.Generic.IEnumerator

提交回复
热议问题