NoEnumerationAttribute Class
Indicates that IEnumerable passed as a parameter is not enumerated.
Use this annotation to suppress the 'Possible multiple enumeration of IEnumerable' inspection.
Namespace:
RingSoft.DataEntryControls.Engine.AnnotationsAssembly: RingSoft.DataEntryControls.Engine (in RingSoft.DataEntryControls.Engine.dll)
Syntax
[AttributeUsageAttribute] public sealed class NoEnumerationAttribute : Attribute
<AttributeUsageAttribute> _ Public NotInheritable Class NoEnumerationAttribute _ Inherits Attribute
[AttributeUsageAttribute] public ref class NoEnumerationAttribute sealed : public Attribute
Examples
C#
static void ThrowIfNull<T>([NoEnumeration] T v, string n) where T : class { // custom check for null but no enumeration } void Foo(IEnumerable<string> values) { ThrowIfNull(values, nameof(values)); var x = values.ToList(); // No warnings about multiple enumeration }