Click or drag to resize
CanBeNullAttribute Class
Indicates that the value of the marked element could be null sometimes, so the check for null is necessary before its usage
Inheritance Hierarchy
SystemObject
  SystemAttribute
    Hangfire.AnnotationsCanBeNullAttribute

Namespace: Hangfire.Annotations
Assembly: Hangfire.Core (in Hangfire.Core.dll) Version: 1.5.0.0
Syntax
[AttributeUsageAttribute(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter|AttributeTargets.Delegate, AllowMultiple = false, 
	Inherited = true)]
public sealed class CanBeNullAttribute : Attribute

The CanBeNullAttribute type exposes the following members.

Constructors
  NameDescription
Public methodCanBeNullAttribute
Initializes a new instance of the CanBeNullAttribute class
Top
Examples
[CanBeNull] 
public object Test() { return null; }

public void UseTest() 
{
    var p = Test();
    var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
}
See Also