Why Enumerable does not inherit from IEnumerable <T>

I am very confused by this problem and cannot understand it. In the documentation, EnumerableI read the following:

which implement System.Collections.Generic.IEnumerable

and some methods, such as Select()return IEnumerable<TSource>, which we can use from other methods, such as Where()after using this. For instance:

names.Select(name => name).Where(name => name.Length > 3 );

but Enumerabledoes not inherit from IEnumerable<T>and IEnumerable<T>does not contain Select(), Where()etc. also...

I have a mistake?
or is there any reason for this?

+3
source share
6 answers

(), Where() .. " ". " ", .

"this" . :

public static IEnumerable<TSource> Where<TSource>(
    this IEnumerable<TSource> source,
    Func<TSource, bool> predicate
)

IEnumerable<TSource> : Func<TSource, bool> predicate.

+8

. ?

System.Collections.Generic.IEnumerable

IEnumerable<T> Enumerable . ?

?

0

IEnumerable IEnumerable<T>, 2.0+.

0

" ?"

Enumerable - , 50 IEnumerable. , IEnumerable, . Enumerable , ( List, Dictionary, Set ..) .

0

, Cast<T>(), IEnumerable<T> .

DataTable dt = ...
dt.Rows.Cast<DataRow>().Where()...

Rows IEnumerable, IEnumerable<DataRow>, LINQ.

0
source

I also said that you are reading this article Iterators, Iterator Blocks, and Data Pipelines from Jon Skeet for Further Understanding

-2
source

Source: https://habr.com/ru/post/1749170/


All Articles