What is the correct way to check if an IEnumerable is generated by the
yield keyword ?
Sample :
public IEnumerable
I wouldn't necessarily say it's the correct way, but A way is:
someInts.GetType().Name.Contains("")
This is probably fairly reliable since this name is very abnormal. Since you're relying on deep internals it could change between any .NET release, although i feel it probably wouldn't/hasn't.
If you use this, make sure to keep a unit test to sanity check it. Such that if the internals do change, your unit test will fail on the build server.