This class encapsulates a non-null reference. An of this class instance serves as evidence that the encapsulated reference is not null.
Namespace: Sasa
Assembly: Sasa
Collapse/Expand Syntax
C#
public sealed class NonNull<T> :  ValueType,
IEquatable<TCollection>,
IEquatable<NonNull<T>>,
IValue<T>
where T  : class
Type Parameters
T
The type of the encapsulated reference.
Collapse/Expand Remarks
Proper usage is to never create or declare NonNull types as locals. NonNull should only be used to decorate method arguments. The only way an invalid instance of NonNull can be created is when declaring it as a local: ... NonNull<T> foo; ... T bar = foo; // NullReferenceException When it comes to high assurance code, you should utilize Option and NonNull types for method arguments, to declare which arguments may be null and which must necessarily be non-null. The type checker will ensure that values are handled properly within the method, and client code will receive the errors when passing in null references for NonNull values.
Collapse/Expand Members

Click here to see the list of members.