ItemCanBeNullAttribute 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 be null.
Namespace:
RingSoft.DataEntryControls.Engine.AnnotationsAssembly: RingSoft.DataEntryControls.Engine (in RingSoft.DataEntryControls.Engine.dll)
Syntax
[AttributeUsageAttribute] public sealed class ItemCanBeNullAttribute : Attribute
<AttributeUsageAttribute> _ Public NotInheritable Class ItemCanBeNullAttribute _ Inherits Attribute
[AttributeUsageAttribute] public ref class ItemCanBeNullAttribute sealed : public Attribute
Examples
C#
public void Foo([ItemCanBeNull]List<string> books) { foreach (var book in books) { // Warning: Possible 'System.NullReferenceException' Console.WriteLine(book.ToUpper()); } }