Share via


ConvertToRdfType(T) Generic Method

Converts the current RDF object to another RDF type and returns the resulting object.

Namespace:  Microsoft.Imm.Sdk.Rdf
Assembly:  Microsoft.Imm.Sdk (in Microsoft.Imm.Sdk)
Version: 1.0.0.0 (1.0.0.0)

Syntax

public T ConvertToRdfType<T>() where T : SubjectBase

Type Parameters

  • T
    The target RDF type

Return Value

An RDF object of the specified type that contains a reference to the current object's underlying TripleCollection

Examples

Note that, in this example, we are converting up to a parent type but none of the underlying data is lost.

CopyC#

Container myContainer = new Container(new Uri("guid:_" + Guid.NewGuid()));
VideoItem myVideo = new VideoItem(new Uri("guid:_" + Guid.NewGuid()));
// ItemCollection is an array of "Item" so we must convert our VideoItem.
Item myVideoAsItem = myVideo.ConvertToRdfType<Item>();
myContainer.ItemCollection.Add(myVideoAsItem);

See Also

SubjectBase Class

Microsoft.Imm.Sdk.Rdf Namespace