Interface IReadOnlyAttribute
A read-only AML attribute
Namespace: Innovator.Client
Assembly: Innovator.Client.dll
Syntax
public interface IReadOnlyAttribute
Properties
| Improve this Doc View SourceExists
Returns true
if this element actually exists in the underlying AML,
otherwise, returns false
to indicate that the element is just a null placeholder
put in place to reduce unnecessary null reference checks
Declaration
bool Exists { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Name
Get the local XML name of the attribute
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Value
Get the string value of the attribute
Declaration
string Value { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceAsBoolean()
Value converted to a System.Nullable<T>. If the value cannot be converted, an exception is thrown
Declaration
bool ? AsBoolean()
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> | A System.Boolean or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Boolean |
AsBoolean(Boolean)
Value converted to a System.Boolean using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
bool AsBoolean(bool defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.Boolean | A System.Boolean or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Boolean |
AsDateTime()
Value converted to a System.Nullable<T> in the local timezone. If the value cannot be converted, an exception is thrown
Declaration
DateTime? AsDateTime()
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | A System.DateTime or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTime |
AsDateTime(DateTime)
Value converted to a System.DateTime in the local timezone using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
DateTime AsDateTime(DateTime defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime or |
Examples
// If the part was created after 2016-01-01, put the name of the creator in the description
if (comp.CreatedOn().AsDateTime(DateTime.MaxValue) > new DateTime(2016, 1, 1))
{
edits.Property("description").Set("Created by: " + comp.CreatedById().KeyedName().Value);
}
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTime |
AsDateTimeUtc()
Value converted to a System.Nullable<T> in the UTC timezone. If the value cannot be converted, an exception is thrown
Declaration
DateTime? AsDateTimeUtc()
Returns
Type | Description |
---|---|
System.Nullable<System.DateTime> | A System.DateTime or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTime |
AsDateTimeUtc(DateTime)
Value converted to a System.DateTime in the UTC timezone using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
DateTime AsDateTimeUtc(DateTime defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.DateTime | A System.DateTime or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.DateTime |
AsDouble()
Value converted to a System.Nullable<T>. If the value cannot be converted, an exception is thrown
Declaration
double ? AsDouble()
Returns
Type | Description |
---|---|
System.Nullable<System.Double> | A System.Double or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Double |
AsDouble(Double)
Value converted to a System.Double using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
double AsDouble(double defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.Double | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.Double | A System.Double or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Double |
AsGuid()
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 |
AsInt()
Value converted to a System.Nullable<T>. If the value cannot be converted, an exception is thrown
Declaration
int ? AsInt()
Returns
Type | Description |
---|---|
System.Nullable<System.Int32> | A System.Int32 or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Int32 |
AsInt(Int32)
Value converted to a System.Int32 using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
int AsInt(int defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.Int32 | A System.Int32 or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Int32 |
AsLong()
Value converted to a System.Nullable<T>. If the value cannot be converted, an exception is thrown
Declaration
long ? AsLong()
Returns
Type | Description |
---|---|
System.Nullable<System.Int64> | A System.Int64 or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Int64 |
AsLong(Int64)
Value converted to a System.Int64 using the defaultValue
if null.
If the value cannot be converted, an exception is thrown
Declaration
long AsLong(long defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.Int64 | A System.Int64 or |
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | If the non-empty value cannot be converted to a System.Int64 |
AsString(String)
Value converted to a System.String using the defaultValue
if null.
Declaration
string AsString(string defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | defaultValue | The default value to return if the value is empty |
Returns
Type | Description |
---|---|
System.String | A System.String or |