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
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public:
virtual int GetExpansionFunction(
	IXMLDOMNode^ xmlFunctionNode,
	String^ fieldName,
	[OutAttribute] IVsExpansionFunction^% func
)

Parameters

xmlFunctionNode
Type: MSXML::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.

This method is an implementation of the GetExpansionFunction method on the IVsExpansionClient interface.

The base method converts the object into an XmlElement object and calls the other GetExpansionFunction method.dd001f09-8d9b-477a-9d71-b86ad99bf444

Here is how the managed package framework implements this GetExpansionFunction method. This example shows how to convert an object into an XmlElement object in C#.dd001f09-8d9b-477a-9d71-b86ad99bf444

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;
        }
    }
}
Return to top
Show: