GetValueOrDefault

Feature.GetValueOrDefault<T> method (1 of 3)

Gets the value of an attribute, or DefaultValue if the value is unset or null.

public T GetValueOrDefault<T>(string attributeName)
Parameter Description
T Desired type for the value.
attributeName Name of the attribute.

Return Value

Value of the attribute.

Exceptions

exception condition
ArgumentNullException The attribute name is null.
ArgumentException The attribute with this name does not exist in this layer.
InvalidOperationException The attribute is not locked.
InvalidOperationException The value of this attribute is not set for this feature.
InvalidCastException The requested type does not implement IConvertible.
InvalidCastException Value of the attribute is null, but the requested type is a value type.
FormatException Conversion failed because the value is in incorrect format.
OverflowException Conversion failed because of overflow.

Remarks

This method converts the value automatically to the type requested in the generic type parameter.

See Also


Feature.GetValueOrDefault method (2 of 3)

Gets the value of an attribute, or DefaultValue if the value is unset or null.

public object GetValueOrDefault(string attributeName, object defaultValue = null)
Parameter Type Description
attributeName String Name of the attribute.
defaultValue Object The value to return if the attribute value is missing. Default value is null.

Return Value

Value of the attribute.

Exceptions

exception condition
ArgumentNullException The attribute name is null.
ArgumentException The attribute with this name does not exist in this layer.
InvalidOperationException The attribute is not locked.
InvalidOperationException The value of this attribute is not set for this feature.

See Also


Feature.GetValueOrDefault<T> method (3 of 3)

Gets the value of an attribute, or DefaultValue if the value is unset or null.

public T GetValueOrDefault<T>(string attributeName, object defaultValue)
Parameter Description
T Desired type for the value.
attributeName Name of the attribute.
defaultValue The value to return if the attribute value is missing.

Return Value

Value of the attribute.

Exceptions

exception condition
ArgumentNullException The attribute name is null.
ArgumentException The attribute with this name does not exist in this layer.
InvalidOperationException The attribute is not locked.
InvalidOperationException The value of this attribute is not set for this feature.
InvalidCastException The requested type does not implement IConvertible.
InvalidCastException Value of the attribute is null, but the requested type is a value type.
FormatException Conversion failed because the value is in incorrect format.
OverflowException Conversion failed because of overflow.

Remarks

This method converts the value automatically to the type requested in the generic type parameter.

See Also