zoukankan      html  css  js  c++  java
  • 实现对象集合枚举接口

    实现接口 IEnumerator, IEnumerable

    Code

    return userList.GetEnumerator();  这里,可以改为迭代器直接实现(C#2.0支持):

    for (int i = 0; i < userList.Count; i++)
                    
    yield return userList[i];

    调用代码,实例:

    Code
  • 相关阅读:
    POJ 3211 (分组01背包) Washing Clothes
    CodeForces 489D Unbearable Controversy of Being
    CodeForces 489C (贪心) Given Length and Sum of Digits...
    CodeForces 489B (贪心 或 最大匹配) BerSU Ball
    CodeForces 489A (瞎搞) SwapSort
    CodeForces 474.D Flowers
    UVa 1252 (状压DP + 记忆化搜索) Twenty Questions
    UVa 10817 (状压DP + 记忆化搜索) Headmaster's Headache
    【读书笔记】莫比乌斯函数与莫比乌斯反演
    UVa 11437 (梅涅劳斯定理) Triangle Fun
  • 原文地址:https://www.cnblogs.com/silva/p/1452816.html
Copyright © 2011-2022 走看看