Open sandboxFocus

Method GetIteratorInfo

GetIteratorInfo(IMethod)

Gets information about whether a method is a yield-based iterator and returns an IteratorInfo value exposing details about the iterator, such as the ItemType and EnumerableKind.

Declaration
[CompileTime]
public static IteratorInfo GetIteratorInfo(this IMethod method)
Parameters
Type Name Description
IMethod method

The method to inspect.

Returns
Type Description
IteratorInfo

An IteratorInfo containing information about the iterator. The EnumerableKind property is set to None if the method does not return an enumerable or enumerator type.

Remarks

This method is useful for aspects that need to inspect iterator method properties at compile time, for example in BuildAspect.

Note that IsIteratorMethod indicates whether the method uses yield return or yield break, while EnumerableKind indicates the return type regardless of the implementation.

See Also