Freigeben über


Entity.GetAttributeValue Methode

Gets the value of the attribute.

Namespace: Microsoft.Xrm.Sdk
Assembly: Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Syntax

'Declaration
Public Overridable Function GetAttributeValue(Of T) ( _
    attributeLogicalName As String _
) As T
public virtual T GetAttributeValue<T> (
    string attributeLogicalName
)

GenericParameters

  • T
    Type: Typ. The type of the attribute.

Parameter

  • attributeLogicalName
    Type: Zeichenfolge. The logical name of the attribute.

Rückgabewert

Type: Typ
The value of the attribute.

Beispiel

GetAttributeValue<EntityReference>("regardingobjectid")

Anmerkungen

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 to check whether the entity instance includes the attribute.

Thread-Sicherheit

Alle öffentlichen statischen Mitglieder (Shared in Visual Basic) dieses Typs sind thread-sicher. Bei Instanzmitgliedern kann keine Garantie für die Thread-Sicherheit übernommen werden.

Plattformen

Development Platforms

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Target Platforms

Windows Server 2008,Windows Server 2012,Windows 7

Change History

Siehe auch

Referenz

Entity Klasse
Entity Mitglieder
Microsoft.Xrm.Sdk Namespace

Weitere Ressourcen

Blog Post: Entity.GetAttributeValue<T> Explained

Send comments about this topic to Microsoft.
© 2015 Microsoft. All rights reserved.