Partilhar via


Source.GetUserData(Guid) Method

Definition

Gets the user data associated with the specified GUID.

public:
 System::Object ^ GetUserData(Guid % key);
public object GetUserData (ref Guid key);
member this.GetUserData : Guid -> obj
Public Function GetUserData (ByRef key As Guid) As Object

Parameters

key
Guid

The GUID specifying what user data to retrieve.

Returns

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

Examples

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;  
        }  
    }  
}  

Remarks

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.

Applies to