ArcFM Desktop Developer Guide
CanBeNullAttribute Class
Members  Example 


Product Availability
Required Licenses
.NET Assembly
Indicates that the value of the marked element could be null sometimes, so the check for null is necessary before its usage
Object Model
CanBeNullAttribute Class
Syntax
'Declaration
 
<AttributeUsageAttribute(ValidOn=AttributeTargets.Method Or  _
    AttributeTargets.Property Or  _
    AttributeTargets.Field Or  _
    AttributeTargets.Parameter Or  _
    AttributeTargets.Delegate, 
   AllowMultiple=False, 
   Inherited=True)>
Public NotInheritable Class CanBeNullAttribute 
   Inherits System.Attribute
'Usage
 
Dim instance As CanBeNullAttribute
[AttributeUsage(ValidOn=AttributeTargets.Method | 
    AttributeTargets.Property | 
    AttributeTargets.Field | 
    AttributeTargets.Parameter | 
    AttributeTargets.Delegate, 
   AllowMultiple=false, 
   Inherited=true)]
public sealed class CanBeNullAttribute : System.Attribute 
Example
[CanBeNull] public object Test() { return null; }
public void UseTest() {
  var p = Test();
  var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
}
Inheritance Hierarchy

System.Object
   System.Attribute
      Miner.Desktop.DesignerExpress.Annotations.CanBeNullAttribute

Requirements

Target Platforms: Windows XP SP3 (32-bit and 64-bit), Windows 7 (32-bit and 64-bit)

Not all Operating Systems are supported on all products. Visit the ArcFM Solution Supported Versions page for full details.

See Also

Reference

CanBeNullAttribute Members
Miner.Desktop.DesignerExpress.Annotations Namespace

 

 


Send Comment