Constable Authorization Engine 2.0 BETA

Property.Owner Property

[This is preliminary documentation and subject to change.]

Returns the PropertyCollection instance that owns this Property object.

[Visual Basic]
Public ReadOnly Property Owner As PropertyCollection
[C#]
public PropertyCollection Owner {get;}

Property Value

Reference to the PropertyCollection that owns the current Property object, or a null reference (Nothing in Visual Basic) if the object is not contained within a collection.

Remarks

Adding an object to a collection automatically sets the Owner property to refer to the containing collection. Conversely, removing the object from the collection sets the Owner property to a null reference (Nothing in Visual Basic), as the following code fagment illustrates:

[Visual Basic]
Imports System
Imports System.Diagnostics
Imports LaMarvin.Constable
Imports LaMarvin.Constable.Model

Dim Prop As New Property("Name")
Debug.Assert(Prop.Owner Is Nothing)

Dim AuthorizationPolicy As New Policy
Policy.Properties.Add(Prop)
Debug.Assert(Not Prop.Owner Is Nothing)
Debug.Assert(Prop.Owner.Equals(Policy.Properties))

Policy.Properties.Remove(Prop)
Debug.Assert(Prop.Owner Is Nothing)
[C#]
using System;
using System.Diagnostics;
using LaMarvin.Constable;
using LaMarvin.Constable.Model;

Property property = new Property("Name");
Debug.Assert(property.Owner == null);

AuthorizationPolicy policy = new AuthorizationPolicy();
policy.Properties.Add(property);
Debug.Assert(property.Owner != null);
Debug.Assert(property.Owner.Equals(policy.Properties));

policy.Properties.Remove(property);
Debug.Assert(property.Owner == null);

See Also

Property Class | LaMarvin.Constable.Model Namespace