Source::GetUserData Method (Guid)

 

Gets the user data associated with the specified GUID.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public:
Object^ GetUserData(
	Guid% key
)

Parameters

key
Type: System::Guid

The GUID specifying what user data to retrieve.

Return Value

Type: System::Object^

If successful, returns an object representing the requested data; otherwise, returns an error code.

This method obtains the IVsUserData interface from the IVsTextLines object (which was passed to the Source class constructor), and then calls the GetData method with the given GUID.

The following GUIDs are supported:

GUID

Value Type

Description

GUID_VsLang_Support_CF_HTML

Boolean

True if the language service recognizes the clipboard format CF_HTML and allows pasting of HTML fragments.

Here is an example of how to call this method (see "Language GUIDs" section of the IDE GUIDs topics to get the value for the GUID_VsLang_Support_CF_HTML constant).

namespace MyLanguagePackage
{
    class MySource : Source
    {
        bool IsHTMLSupported()
        {
            bool bSupported = false;
            object value = GetUserData(GUID_VSLang_Support_CF_HTML);
            if (value != null)
            {
                bSupported = Convert.ToBoolean(value);
            }
            return bSupported;
        }
    }
}
Return to top
Show: