Share via


Entity.ToEntity<T> Method

Definition

Gets the entity as the specified type.

public:
generic <typename T>
 where T : Microsoft::Xrm::Sdk::Entity T ToEntity();
public T ToEntity<T> () where T : Microsoft.Xrm.Sdk.Entity;
member this.ToEntity : unit -> 'T (requires 'T :> Microsoft.Xrm.Sdk.Entity)
Public Function ToEntity(Of T As Entity) () As T

Type Parameters

T

The entity type to return.

Returns

T

The entity as the specified type.

Examples

Account retrievedAccount = service.Retrieve(account.LogicalName, account.Id, new ColumnSet("primarycontactid")).ToEntity<Account>();

Applies to