Class PropertyContainer
The PropertyContainer class is used as the entry point to operate on data containers using properties.
Inherited Members
Namespace: Unity.Properties
Syntax
public static class PropertyContainer
Methods
Accept<TContainer>(IPropertyBagVisitor, TContainer, VisitParameters)
Visit the specified container
using the specified visitor
.
Declaration
public static void Accept<TContainer>(IPropertyBagVisitor visitor, TContainer container, VisitParameters parameters = default(VisitParameters))
Parameters
Type | Name | Description |
---|---|---|
IPropertyBagVisitor | visitor | The visitor. |
TContainer | container | The container to visit. |
VisitParameters | parameters | The visit parameters to use. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The container is null. |
InvalidContainerTypeException | The given container type is not valid for visitation. |
MissingPropertyBagException | No property bag was found for the given container. |
Accept<TContainer>(IPropertyBagVisitor, ref TContainer, VisitParameters)
Visit the specified container
using the specified visitor
.
Declaration
public static void Accept<TContainer>(IPropertyBagVisitor visitor, ref TContainer container, VisitParameters parameters = default(VisitParameters))
Parameters
Type | Name | Description |
---|---|---|
IPropertyBagVisitor | visitor | The visitor. |
TContainer | container | The container to visit. |
VisitParameters | parameters | The visit parameters to use. |
Type Parameters
Name | Description |
---|---|
TContainer | The declared container type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The container is null. |
InvalidContainerTypeException | The container is null. |
MissingPropertyBagException | No property bag was found for the given container. |
Accept<TContainer>(IPropertyVisitor, ref TContainer, in PropertyPath, VisitParameters)
Visit the specified container
using the specified visitor
at the given PropertyPath.
Declaration
public static void Accept<TContainer>(IPropertyVisitor visitor, ref TContainer container, in PropertyPath path, VisitParameters parameters = default(VisitParameters))
Parameters
Type | Name | Description |
---|---|---|
IPropertyVisitor | visitor | The visitor. |
TContainer | container | The container to visit. |
PropertyPath | path | The property path to visit. |
VisitParameters | parameters | The visit parameters to use. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The container is null. |
InvalidContainerTypeException | The given container type is not valid for visitation. |
MissingPropertyBagException | No property bag was found for the given container. |
GetProperty<TContainer>(TContainer, in PropertyPath)
Gets an IProperty on the specified container for the given PropertyPath.
Declaration
public static IProperty GetProperty<TContainer>(TContainer container, in PropertyPath path)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container tree to search. |
PropertyPath | path | The property path to resolve. |
Returns
Type | Description |
---|---|
IProperty | The IProperty for the given path. |
Type Parameters
Name | Description |
---|---|
TContainer | The strongly typed container. |
Remarks
While the container data is not actually read from or written to. The container itself is needed to resolve polymorphic fields and list elements.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidPathException | The specified |
GetProperty<TContainer>(ref TContainer, in PropertyPath)
Gets an IProperty on the specified container for the given PropertyPath.
Declaration
public static IProperty GetProperty<TContainer>(ref TContainer container, in PropertyPath path)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be returned. |
PropertyPath | path | The property path to resolve. |
Returns
Type | Description |
---|---|
IProperty | The IProperty for the given path. |
Type Parameters
Name | Description |
---|---|
TContainer | The strongly typed container. |
Remarks
While the container data is not actually read from or written to. The container itself is needed to resolve polymorphic fields and list elements.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidPathException | The specified |
GetValue<TContainer, TValue>(TContainer, String)
Gets the value of a property by name.
Declaration
public static TValue GetValue<TContainer, TValue>(TContainer container, string name)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
String | name | The name of the property to get. |
Returns
Type | Description |
---|---|
TValue | The value for the specified name. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidCastException | The specified |
InvalidPathException | The specified |
GetValue<TContainer, TValue>(TContainer, in PropertyPath)
Gets the value of a property by path.
Declaration
public static TValue GetValue<TContainer, TValue>(TContainer container, in PropertyPath path)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
PropertyPath | path | The path of the property to get. |
Returns
Type | Description |
---|---|
TValue | The value at the specified path. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidCastException | The specified |
InvalidPathException | The specified |
GetValue<TContainer, TValue>(ref TContainer, String)
Gets the value of a property by name.
Declaration
public static TValue GetValue<TContainer, TValue>(ref TContainer container, string name)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
String | name | The name of the property to get. |
Returns
Type | Description |
---|---|
TValue | The value for the specified name. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidCastException | The specified |
InvalidPathException | The specified |
GetValue<TContainer, TValue>(ref TContainer, in PropertyPath)
Gets the value of a property by path.
Declaration
public static TValue GetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
PropertyPath | path | The path of the property to get. |
Returns
Type | Description |
---|---|
TValue | The value at the specified path. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidCastException | The specified |
InvalidPathException | The specified |
IsPathValid<TContainer>(TContainer, String)
Returns true if a property exists at the specified PropertyPath.
Declaration
public static bool IsPathValid<TContainer>(TContainer container, string path)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container tree to search. |
String | path | The property path to resolve. |
Returns
Type | Description |
---|---|
Boolean | true if a property can be found at path. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
IsPathValid<TContainer>(TContainer, in PropertyPath)
Returns true if a property exists at the specified PropertyPath.
Declaration
public static bool IsPathValid<TContainer>(TContainer container, in PropertyPath path)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container tree to search. |
PropertyPath | path | The property path to resolve. |
Returns
Type | Description |
---|---|
Boolean | true if a property can be found at path. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
IsPathValid<TContainer>(ref TContainer, String)
Returns true if a property exists at the specified PropertyPath.
Declaration
public static bool IsPathValid<TContainer>(ref TContainer container, string path)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container tree to search. |
String | path | The property path to resolve. |
Returns
Type | Description |
---|---|
Boolean | true if a property can be found at path. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
IsPathValid<TContainer>(ref TContainer, in PropertyPath)
Returns true if a property exists at the specified PropertyPath.
Declaration
public static bool IsPathValid<TContainer>(ref TContainer container, in PropertyPath path)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container tree to search. |
PropertyPath | path | The property path to resolve. |
Returns
Type | Description |
---|---|
Boolean | true if a property can be found at path. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
SetValue<TContainer, TValue>(TContainer, String, TValue)
Sets the value of a property by name to the given value.
Declaration
public static void SetValue<TContainer, TValue>(TContainer container, string name, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
String | name | The name of the property to set. |
TValue | value | The value to assign to the property. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidCastException | The specified |
InvalidPathException | The specified |
SetValue<TContainer, TValue>(TContainer, in PropertyPath, TValue)
Sets the value of a property at the given path to the given value.
Declaration
public static void SetValue<TContainer, TValue>(TContainer container, in PropertyPath path, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
PropertyPath | path | The path of the property to set. |
TValue | value | The value to assign to the property. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidCastException | The specified |
InvalidPathException | The specified |
SetValue<TContainer, TValue>(ref TContainer, String, TValue)
Sets the value of a property by name to the given value.
Declaration
public static void SetValue<TContainer, TValue>(ref TContainer container, string name, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
String | name | The name of the property to set. |
TValue | value | The value to assign to the property. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidCastException | The specified |
InvalidPathException | The specified |
SetValue<TContainer, TValue>(ref TContainer, in PropertyPath, TValue)
Sets the value of a property at the given path to the given value.
Declaration
public static void SetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
PropertyPath | path | The path of the property to set. |
TValue | value | The value to assign to the property. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified container or path is null. |
InvalidContainerTypeException | The specified container type is not valid for visitation. |
MissingPropertyBagException | The specified container type has no property bag associated with it. |
InvalidCastException | The specified |
InvalidPathException | The specified |
AccessViolationException | The specified |
TryAccept<TContainer>(IPropertyBagVisitor, ref TContainer, VisitParameters)
Tries to visit the specified container
by ref using the specified visitor
.
Declaration
public static bool TryAccept<TContainer>(IPropertyBagVisitor visitor, ref TContainer container, VisitParameters parameters = default(VisitParameters))
Parameters
Type | Name | Description |
---|---|---|
IPropertyBagVisitor | visitor | The visitor. |
TContainer | container | The container to visit. |
VisitParameters | parameters | The visit parameters to use. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The declared container type. |
TryAccept<TContainer>(IPropertyBagVisitor, ref TContainer, out VisitReturnCode, VisitParameters)
Tries to visit the specified container
by ref using the specified visitor
.
Declaration
public static bool TryAccept<TContainer>(IPropertyBagVisitor visitor, ref TContainer container, out VisitReturnCode returnCode, VisitParameters parameters = default(VisitParameters))
Parameters
Type | Name | Description |
---|---|---|
IPropertyBagVisitor | visitor | The visitor. |
TContainer | container | The container to visit. |
VisitReturnCode | returnCode | When this method returns, contains the return code. |
VisitParameters | parameters | The visit parameters to use. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The declared container type. |
TryAccept<TContainer>(IPropertyVisitor, ref TContainer, in PropertyPath, out VisitReturnCode, VisitParameters)
Visit the specified container
using the specified visitor
at the given PropertyPath.
Declaration
public static bool TryAccept<TContainer>(IPropertyVisitor visitor, ref TContainer container, in PropertyPath path, out VisitReturnCode returnCode, VisitParameters parameters = default(VisitParameters))
Parameters
Type | Name | Description |
---|---|---|
IPropertyVisitor | visitor | The visitor. |
TContainer | container | The container to visit. |
PropertyPath | path | The property path to visit. |
VisitReturnCode | returnCode | When this method returns, contains the return code. |
VisitParameters | parameters | The visit parameters to use. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The container is null. |
InvalidContainerTypeException | The given container type is not valid for visitation. |
MissingPropertyBagException | No property bag was found for the given container. |
TryGetProperty<TContainer>(TContainer, in PropertyPath, out IProperty)
Gets an IProperty on the specified container for the given PropertyPath.
Declaration
public static bool TryGetProperty<TContainer>(TContainer container, in PropertyPath path, out IProperty property)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container tree to search. |
PropertyPath | path | The property path to resolve. |
IProperty | property | When this method returns, contains the property associated with the specified path, if the property is found; otherwise, null. |
Returns
Type | Description |
---|---|
Boolean | true if the property was found at the specified path; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TContainer | The strongly typed container. |
Remarks
While the container data is not actually read from or written to. The container itself is needed to resolve polymorphic fields and list elements.
TryGetProperty<TContainer>(ref TContainer, in PropertyPath, out IProperty)
Gets an IProperty on the specified container for the given PropertyPath.
Declaration
public static bool TryGetProperty<TContainer>(ref TContainer container, in PropertyPath path, out IProperty property)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container tree to search. |
PropertyPath | path | The property path to resolve. |
IProperty | property | When this method returns, contains the property associated with the specified path, if the property is found; otherwise, null. |
Returns
Type | Description |
---|---|
Boolean | true if the property was found at the specified path; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TContainer | The strongly typed container. |
Remarks
While the container data is not actually read from or written to. The container itself is needed to resolve polymorphic fields and list elements.
TryGetProperty<TContainer>(ref TContainer, in PropertyPath, out IProperty, out VisitReturnCode)
Gets an IProperty on the specified container for the given PropertyPath.
Declaration
public static bool TryGetProperty<TContainer>(ref TContainer container, in PropertyPath path, out IProperty property, out VisitReturnCode returnCode)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container tree to search. |
PropertyPath | path | The property path to resolve. |
IProperty | property | When this method returns, contains the property associated with the specified path, if the property is found; otherwise, null. |
VisitReturnCode | returnCode | When this method returns, contains the return code. |
Returns
Type | Description |
---|---|
Boolean | true if the property was found at the specified path; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TContainer | The strongly typed container. |
Remarks
While the container data is not actually read from or written to. The container itself is needed to resolve polymorphic fields and list elements.
TryGetValue<TContainer, TValue>(TContainer, String, out TValue)
Gets the value of a property by name.
Declaration
public static bool TryGetValue<TContainer, TValue>(TContainer container, string name, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
String | name | The name of the property to get. |
TValue | value | When this method returns, contains the value associated with the specified name, if the property is found. otherwise the default value for the |
Returns
Type | Description |
---|---|
Boolean | true if the value exists for the specified name; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
TryGetValue<TContainer, TValue>(TContainer, in PropertyPath, out TValue)
Gets the value of a property by path.
Declaration
public static bool TryGetValue<TContainer, TValue>(TContainer container, in PropertyPath path, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
PropertyPath | path | The path of the property to get. |
TValue | value | When this method returns, contains the value associated with the specified path, if the property is found. otherwise the default value for the |
Returns
Type | Description |
---|---|
Boolean | The property value of the given container. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type to set. |
TryGetValue<TContainer, TValue>(ref TContainer, String, out TValue)
Gets the value of a property by name.
Declaration
public static bool TryGetValue<TContainer, TValue>(ref TContainer container, string name, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
String | name | The name of the property to get. |
TValue | value | When this method returns, contains the value associated with the specified name, if the property is found. otherwise the default value for the |
Returns
Type | Description |
---|---|
Boolean | true if the value exists for the specified name; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
TryGetValue<TContainer, TValue>(ref TContainer, in PropertyPath, out TValue)
Gets the value of a property by path.
Declaration
public static bool TryGetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
PropertyPath | path | The path of the property to get. |
TValue | value | When this method returns, contains the value associated with the specified path, if the property is found. otherwise the default value for the |
Returns
Type | Description |
---|---|
Boolean | true if the value exists at the specified path; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
TryGetValue<TContainer, TValue>(ref TContainer, in PropertyPath, out TValue, out VisitReturnCode)
Gets the value of a property by path.
Declaration
public static bool TryGetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, out TValue value, out VisitReturnCode returnCode)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property value will be returned. |
PropertyPath | path | The path of the property to get. |
TValue | value | When this method returns, contains the value associated with the specified path, if the property is found. otherwise the default value for the |
VisitReturnCode | returnCode | When this method returns, contains the return code. |
Returns
Type | Description |
---|---|
Boolean | true if the value exists at the specified path; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TContainer | The container type. |
TValue | The value type. |
TrySetValue<TContainer, TValue>(TContainer, String, TValue)
Tries to set the value of a property at the given path to the given value.
Declaration
public static bool TrySetValue<TContainer, TValue>(TContainer container, string name, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
String | name | The name of the property to set. |
TValue | value | The value to assign to the property. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.
TrySetValue<TContainer, TValue>(TContainer, in PropertyPath, TValue)
Tries to set the value of a property at the given path to the given value.
Declaration
public static bool TrySetValue<TContainer, TValue>(TContainer container, in PropertyPath path, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
PropertyPath | path | The path of the property to set. |
TValue | value | The value to assign to the property. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.
TrySetValue<TContainer, TValue>(ref TContainer, String, TValue)
Tries to set the value of a property at the given path to the given value.
Declaration
public static bool TrySetValue<TContainer, TValue>(ref TContainer container, string name, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
String | name | The name of the property to set. |
TValue | value | The value to assign to the property. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.
TrySetValue<TContainer, TValue>(ref TContainer, in PropertyPath, TValue)
Tries to set the value of a property at the given path to the given value.
Declaration
public static bool TrySetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
PropertyPath | path | The path of the property to set. |
TValue | value | The value to assign to the property. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.
TrySetValue<TContainer, TValue>(ref TContainer, in PropertyPath, TValue, out VisitReturnCode)
Tries to set the value of a property at the given path to the given value.
Declaration
public static bool TrySetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, TValue value, out VisitReturnCode returnCode)
Parameters
Type | Name | Description |
---|---|---|
TContainer | container | The container whose property will be set. |
PropertyPath | path | The path of the property to set. |
TValue | value | The value to assign to the property. |
VisitReturnCode | returnCode | When this method returns, contains the return code. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
TContainer | The container type to set the value on. |
TValue | The value type to set. |
Remarks
This method is NOT thread safe.