ItemNotNullAttribute Class
Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task
and Lazy classes to indicate that the value of a collection item, of the Task.Result property
or of the Lazy.Value property can never be null.
Namespace:
RingSoft.DbLookup.Controls.WPF.PropertiesAssembly: RingSoft.DbLookup.Controls.WPF (in RingSoft.DbLookup.Controls.WPF.dll)
Syntax
[AttributeUsageAttribute] public sealed class ItemNotNullAttribute : Attribute
<AttributeUsageAttribute> _ Public NotInheritable Class ItemNotNullAttribute _ Inherits Attribute
[AttributeUsageAttribute] public ref class ItemNotNullAttribute sealed : public Attribute
Examples
C#
public void Foo([ItemNotNull]List<string> books) { foreach (var book in books) { if (book != null) // Warning: Expression is always true Console.WriteLine(book.ToUpper()); } }