DirectiveProcessor.GetReferencesForProcessingRun 方法
在派生类中重写时,获取要传递到已生成转换类编译器的引用。
命名空间: Microsoft.VisualStudio.TextTemplating
程序集: Microsoft.VisualStudio.TextTemplating.11.0(在 Microsoft.VisualStudio.TextTemplating.11.0.dll 中)
语法
声明
Public MustOverride Function GetReferencesForProcessingRun As String()
public abstract string[] GetReferencesForProcessingRun()
public:
virtual array<String^>^ GetReferencesForProcessingRun() abstract
abstract GetReferencesForProcessingRun : unit -> string[]
public abstract function GetReferencesForProcessingRun() : String[]
返回值
类型:array<System.String[]
一个包含引用的类型 String 的数组。
实现
IDirectiveProcessor.GetReferencesForProcessingRun()
备注
要成功编译,指令处理器添加到生成的转换类的代码可能需要特定的程序集。指令处理器应在此方法中添加对所需程序集的引用。
如果指令处理器需要它自己的代码可用于生成的转换类,则指令处理器应该将它自己的程序集添加到引用列表。
示例
下面的代码示例演示自定义指令处理器的可能实现。此代码示例摘自为 DirectiveProcessor 类提供的一个更大的示例。
public override string[] GetReferencesForProcessingRun()
{
//We need a reference to this assembly to be able to call
//XmlReaderHelper.ReadXml from the generated transformation class.
//-----------------------------------------------------------------
return new string[]
{
"System.Xml",
this.GetType().Assembly.Location
};
}
Public Overrides Function GetReferencesForProcessingRun() As String()
'We need a reference to this assembly to be able to call
'XmlReaderHelper.ReadXml from the generated transformation class.
'-----------------------------------------------------------------
Return New String() {"System.Xml", Me.GetType().Assembly.Location}
End Function
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.VisualStudio.TextTemplating 命名空间