vendredi 17 janvier 2020

In C# is it possible to check if the method is an iterator via reflection?

The question is rather straightforward. Given a MethodBase or a MethodInfo instance how can I check if it represents an iterator method (with yield statements) or a common method (without yield statements)?

I have noticed a IteratorStateMachineAttribute in CustomAttributes property but here it is mentioned that one should not rely on this attribute.





Aucun commentaire:

Enregistrer un commentaire