What is the difference between the non-generic IEnumerable and the generic IEnumerable?

后端 未结 5 1845
不思量自难忘°
不思量自难忘° 2020-12-31 15:34

Sorry for such a vague question, but I have been searching around for the best part of a day, I have read article after article (and many questions here) but just cannot fin

5条回答
  •  盖世英雄少女心
    2020-12-31 16:11

    The word you're looking for is "generics", and the example you give is IEnumerable being used as a generic for items of type int. What that means is that the IEnumerable collection you are using is strongly-typed to only hold int objects as opposed to any other type.

    Google "C# generics IEnumerable" and you will find all of the information you want on this.

提交回复
热议问题