Share via


DirectiveProcessor.GetImportsForProcessingRun Method

When overridden in a derived class, gets namespaces to import into the generated transformation class.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating (in Microsoft.VisualStudio.TextTemplating.dll)

Syntax

'Declaration
Public MustOverride Function GetImportsForProcessingRun As String()
'Usage
Dim instance As DirectiveProcessor 
Dim returnValue As String()

returnValue = instance.GetImportsForProcessingRun()
public abstract string[] GetImportsForProcessingRun()
public:
virtual array<String^>^ GetImportsForProcessingRun() abstract
public abstract function GetImportsForProcessingRun() : String[]

Return Value

Type: array<System.String[]
An array of type String that contains the namespaces.

Remarks

If the directive processor wants its own code to be conveniently accessible to the generated transformation class, the directive processor should add its own namespace to the list of namespaces.

Examples

The following code example shows a possible implementation for a custom directive processor. This code example is part of a larger example provided for the DirectiveProcessor class.

public override string[] GetImportsForProcessingRun()
{
    //This returns the imports or using statements that we want to 
    //add to the generated transformation class.
    //-----------------------------------------------------------------
    //We need CustomDP to be able to call XmlReaderHelper.ReadXml
    //from the generated transformation class.
    //-----------------------------------------------------------------
    return new string[]
    {
        "System.Xml",
        "CustomDP"
    };
}
Public Overrides Function GetImportsForProcessingRun() As String()

    'This returns the imports or using statements that we want to 
    'add to the generated transformation class.
    '-----------------------------------------------------------------
    'We need CustomDP to be able to call XmlReaderHelper.ReadXml
    'from the generated transformation class.
    '-----------------------------------------------------------------
    Return New String() {"System.Xml", "CustomDP"}
End Function

.NET Framework Security

See Also

Reference

DirectiveProcessor Class

DirectiveProcessor Members

Microsoft.VisualStudio.TextTemplating Namespace

GetReferencesForProcessingRun

GetClassCodeForProcessingRun

GetImportsForProcessingRun

Other Resources

Creating Custom Text Template Directive Processors

Walkthrough: Creating a Custom Directive Processor