Udostępnij za pośrednictwem


ExpansionProvider.GetExpansionFunction Method (, 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.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

'Declaration
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
)
public:
virtual int GetExpansionFunction(
    IXMLDOMNode^ xmlFunctionNode, 
    String^ fieldName, 
    [OutAttribute] IVsExpansionFunction^% func
)
abstract GetExpansionFunction : 
        xmlFunctionNode:IXMLDOMNode * 
        fieldName:string * 
        func:IVsExpansionFunction byref -> int 
override GetExpansionFunction : 
        xmlFunctionNode:IXMLDOMNode * 
        fieldName:string * 
        func:IVsExpansionFunction byref -> int 
public function GetExpansionFunction(
    xmlFunctionNode : IXMLDOMNode, 
    fieldName : String, 
    func : IVsExpansionFunction
) : int

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.

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

See Also

Reference

ExpansionProvider Class

GetExpansionFunction Overload

Microsoft.VisualStudio.Package Namespace