Possibile multiple enumeration of an IEnumeration object
Hi.
I get a lot of warnings that perhaps I execute a IEnumeration multiple times when I do a check if the IEnumeration object is null.
I have a method which contains the test code itself.
Is there some way to annotate this method so that I do not get a wanring for a possible multiple enumeration?
DebuggerStepThrough] [AssertionMethod] public static void NotNull<T>([AssertionCondition(AssertionConditionType.IsNotNull)]T value, [LocalizationRequired(false), InvokerParameterName] string parameterName) where T : class { if (value == null) { throw new ArgumentNullException(parameterName); } }
public void SomeMethode(IEnumerable<String> someStrings) {
NotNull(someStrings, "someStrings"); <- warning here
...
}
Kind regards,
Sven
Please sign in to leave a comment.
Hello Sven,
At the moment there's no way to tell ReSharper that a method doesn't enumerate
the IEnumerable. You're welcome to vote for the following feature request:
http://youtrack.jetbrains.net/issue/RSRP-273689. Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Thank you very much Andrey.