Open sandboxFocus

Property UseEnumerableTemplateForAnyEnumerable

UseEnumerableTemplateForAnyEnumerable

Gets or sets a value indicating whether enumerable templates should be selected based on return type rather than the yield modifier.

Declaration
protected bool UseEnumerableTemplateForAnyEnumerable { get; init; }
Property Value
Type Description
bool
Remarks

When false (default), the OverrideEnumerableMethod() or OverrideEnumeratorMethod() templates are used only for methods that use the yield statement.

When true, these templates are used for all methods returning IEnumerable<T> or IEnumerator<T>, regardless of whether they use yield.

This property is useful when you want to handle all methods returning enumerable types uniformly, even if they don't use iterators.