Does Class need to implement IEnumerable to use Foreach

前端 未结 11 1780
慢半拍i
慢半拍i 2020-12-09 11:04

This is in C#, I have a class that I am using from some else\'s DLL. It does not implement IEnumerable but has 2 methods that pass back a IEnumerator. Is there a way I can u

11条回答
  •  盖世英雄少女心
    2020-12-09 11:14

    @Brian: Not sure you try to loop over the value return from method call or the class itself, If what you want is the class then by make it an array you can use with foreach.

提交回复
热议问题