Inside a method that returns IEnumerable<T>
, yield return
has to return T
, not an IEnumerable<T>
.
Replace
yield return c.GetDeepControlsByType<T>();
with:
foreach (var x in c.GetDeepControlsByType<T>())
{
yield return x;
}
More Related Contents:
- Passing a single item as IEnumerable
- Performance of nested yield in a tree
- Why does IEnumerable inherit from IEnumerable?
- Return all enumerables with yield return at once; without looping through
- generic NOT constraint where T : !IEnumerable
- How to capture value OOPS & Generic [closed]
- Create Generic method constraining T to an Enum
- Why can’t the C# constructor infer type?
- Can’t operator == be applied to generic types in C#?
- Nullable type as a generic parameter possible?
- vs in Generics
- Is it worthwhile to initialize the collection size of a List if it’s size reasonably known?
- Generics – where T is a number? [duplicate]
- An extension method on IEnumerable needed for shuffling [duplicate]
- A reusable pattern to convert event into task
- Sorting an IList in C#
- Enumerating Collections that are not inherently IEnumerable?
- How do I create a generic class from a string in C#? [duplicate]
- Parse string to enum type
- Why does this generic constraint compile when it seems to have a circular reference
- Why Enumerable.Cast raises an InvalidCastException?
- Case insensitive access for generic dictionary
- How to define generic type limit to primitive types?
- Why does this generic method require T to have a public, parameterless constructor?
- Are static members of a generic class tied to the specific instance?
- Generics with Generic Parameters and Abstract class
- C# generics compared to C++ templates [duplicate]
- How to constrain generic type to must have a construtor that takes certain parameters?
- How to write this EF Mock setup code as a reusable Generic Boilerplate?
- .NET Managing Layers Relationships