Source.GetUserData Method
Gets the user data associated with the specified GUID.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Syntax
'Déclaration
Public Function GetUserData ( _
ByRef key As Guid _
) As Object
'Utilisation
Dim instance As Source
Dim key As Guid
Dim returnValue As Object
returnValue = instance.GetUserData(key)
public Object GetUserData(
ref Guid key
)
public:
Object^ GetUserData(
Guid% key
)
member GetUserData :
key:Guid byref -> Object
public function GetUserData(
key : Guid
) : Object
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.
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. |
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;
}
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.