Entity.GetAttributeValue<T>(String) Method

Definition

Gets the value of the attribute.

public:
generic <typename T>
 virtual T GetAttributeValue(System::String ^ attributeLogicalName);
public virtual T GetAttributeValue<T> (string attributeLogicalName);
abstract member GetAttributeValue : string -> 'T
override this.GetAttributeValue : string -> 'T
Public Overridable Function GetAttributeValue(Of T) (attributeLogicalName As String) As T

Type Parameters

T

Type: Type. The type of the attribute.

Parameters

attributeLogicalName
String

Type: String. The logical name of the attribute.

Returns

T

Type: Type The value of the attribute.

Examples

GetAttributeValue<EntityReference>("regardingobjectid")

Remarks

When an entity instance does not include the attribute specified using the attributeLogicalName parameter this method will return null rather than throw an exception. You should not assume that the entity includes the attribute. It may not be included if the code that retrieved the attribute didn’t request it. You can use Entity.Contains(String) to check whether the entity instance includes the attribute.

Applies to