從範本產生程式碼,這個程式碼一經編譯和執行,就會產生範本輸出。
命名空間: Microsoft.VisualStudio.TextTemplating
組件: Microsoft.VisualStudio.TextTemplating.10.0 (在 Microsoft.VisualStudio.TextTemplating.10.0.dll 中)
語法
'宣告
Public Function PreprocessTemplate ( _
content As String, _
host As ITextTemplatingEngineHost, _
className As String, _
classNamespace As String, _
<OutAttribute> ByRef language As String, _
<OutAttribute> ByRef references As String() _
) As String
public string PreprocessTemplate(
string content,
ITextTemplatingEngineHost host,
string className,
string classNamespace,
out string language,
out string[] references
)
public:
virtual String^ PreprocessTemplate(
String^ content,
ITextTemplatingEngineHost^ host,
String^ className,
String^ classNamespace,
[OutAttribute] String^% language,
[OutAttribute] array<String^>^% references
) sealed
abstract PreprocessTemplate :
content:string *
host:ITextTemplatingEngineHost *
className:string *
classNamespace:string *
language:string byref *
references:string[] byref -> string
override PreprocessTemplate :
content:string *
host:ITextTemplatingEngineHost *
className:string *
classNamespace:string *
language:string byref *
references:string[] byref -> string
public final function PreprocessTemplate(
content : String,
host : ITextTemplatingEngineHost,
className : String,
classNamespace : String,
language : String,
references : String[]
) : String
參數
- content
型別:System.String
樣板的內容。
- host
型別:Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost
範本主應用程式,應實作 ITextTemplatingEngineHost。
- className
型別:System.String
您要範本程式碼具有的類別名稱。
- classNamespace
型別:System.String
您要在其中產生範本程式碼的命名空間。
- language
型別:System.String%
所產生之程式碼的語言。
- references
型別:array<System.String[]%
範本或主應用程式所指定的組件。
傳回值
型別:System.String
可編譯的字串。
實作
備註
如需詳細資訊,請參閱 使用前置處理過的 T4 文字範本在執行階段產生文字和使用自訂主機處理文字範本。
秘訣 |
|---|
如果您要撰寫將執行於 Visual Studio 的封裝或擴充功能,請考慮使用文字範本化服務,而不是撰寫自己的主應用程式。 如需詳細資訊,請參閱叫用 VS 擴充功能中的文字轉換。 |
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
秘訣