ExpansionProvider.GetExpansionFunction Method (IXMLDOMNode, String, IVsExpansionFunction%)
Returns a IVsExpansionFunction object representing the expansion function described in the given XML template node (COM implementation).
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
Syntax
'宣言
Public Overridable Function GetExpansionFunction ( _
xmlFunctionNode As IXMLDOMNode, _
fieldName As String, _
<OutAttribute> ByRef func As IVsExpansionFunction _
) As Integer
public virtual int GetExpansionFunction(
IXMLDOMNode xmlFunctionNode,
string fieldName,
out IVsExpansionFunction func
)
Parameters
- xmlFunctionNode
Type: IXMLDOMNode
[in] A IXMLDOMNode object representing the expansion function description.
- fieldName
Type: System.String
[in] The name of the variable or field this expansion function represents.
- func
Type: Microsoft.VisualStudio.TextManager.Interop.IVsExpansionFunction%
[out] Returns an IVsExpansionFunction object representing the implementation of the expansion function.
Return Value
Type: System.Int32
If successful, returns S_OK; otherwise, returns an error code.
Implements
IVsExpansionClient.GetExpansionFunction(IXMLDOMNode, String, IVsExpansionFunction%)
Remarks
This method is an implementation of the GetExpansionFunction method on the IVsExpansionClient interface.
The base method converts the IXMLDOMNode object into an XmlElement object and calls the other GetExpansionFunction method.
Examples
Here is how the managed package framework implements this GetExpansionFunction method. This example shows how to convert an IXMLDOMNode object into an XmlElement object in C#.
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.OLE.Interop;
using System.Xml;
using System;
namespace Microsoft.VisualStudio.Package
{
[CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
public class ExpansionProvider : IDisposable, IVsExpansionClient
{
public virtual int GetExpansionFunction(
MSXML.IXMLDOMNode xmlFunctionNode,
string fieldName,
out IVsExpansionFunction func)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlFunctionNode.xml);
func = GetExpansionFunction(doc.DocumentElement, fieldName);
return VsConstants.S_OK;
}
}
}
.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.