Interface IReadOnlyProperty_Item<T>
Represents a property of type item
Inherited Members
Namespace: Innovator.Client
Assembly: Innovator.Client.dll
Syntax
public interface IReadOnlyProperty_Item<in T> : IReadOnlyProperty_Base, IReadOnlyElement, IAmlNode
Type Parameters
Name | Description |
---|---|
T |
Methods
| Improve this Doc View SourceAsGuid()
Value converted to a System.Nullable<T>. If the value cannot be converted, an exception is thrown
Declaration
Guid? AsGuid()
Returns
Type | Description |
---|---|
System.Nullable<System.Guid> | A System.Guid or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Guid |
AsGuid(Guid)
Value converted to a System.Guid using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
Guid AsGuid(Guid defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.Guid | A System.Guid or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Guid |
AsItem()
Value converted to a IReadOnlyItem.
If the value cannot be converted, a 'null' item (where the
Exists property returns false
) is returned
Declaration
IReadOnlyItem AsItem()
Returns
Type | Description |
---|---|
IReadOnlyItem |
Examples
After executing the code
var item = aml.FromXml(@"<Item type='File'>
<created_by_id keyed_name="John Smith" type="User">A5CE5E3B4E3846D8A15C1C9300EAF7B4</created_by_id>
</Item>").AssertItem();
var creator = item.CreatedById().AsItem();
the structure of creator
will be
<Item type='User' id='A5CE5E3B4E3846D8A15C1C9300EAF7B4'gt;
<id keyed_name="John Smith" type="User">A5CE5E3B4E3846D8A15C1C9300EAF7B4</id>
<keyed_name>John Smith</keyed_name>
</Item>