CachedDataItem::DataType Property

 

Gets or sets the assembly-qualified name of the type of the cached data object.

Namespace:   Microsoft.VisualStudio.Tools.Applications
Assembly:  Microsoft.VisualStudio.Tools.Applications.ServerDocument (in Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll)

public:
property String^ DataType {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The assembly-qualified name of the type of the cached data object.

The DataType property returns an assembly-qualified name of the cached data type that is useful for creating a new instance of a custom type that is in the data cache. For example, you can get the Type of a custom data type by passing the assembly-qualified type name to the GetType method. You can then create an instance of the custom type by passing this Type as a parameter to the Activator::CreateInstance method.

For details about the format of the assembly-qualified type string that is returned by the DataType property, see the Type::AssemblyQualifiedName property.

The following code example uses the SerializeDataInstance method to modify the value of a string that is cached in a worksheet of an Excel workbook. The code uses the DataType property to verify that the cached data object is a string before trying to modify it.

This example requires:

  • A document-level customization for Excel that has a Sheet1 class in the ExcelWorkbook1 namespace, and a cached string in the Sheet1 class named CachedString.

  • A console application project or some other non-Office project.

  • References to the following assemblies:

    • Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll

    • Microsoft.VisualStudio.Tools.Applications.Runtime.dll

  • Imports (for Visual Basic) or using (for C#) statements for Microsoft.VisualStudio.Tools.Applications and Microsoft.VisualStudio.Tools.Applications.Runtime namespaces at the top of your code file.

No code example is currently available or this language may not be supported.
Return to top
Show: