Engine 類別
文字範本轉換引擎。
繼承階層架構
Object
Microsoft.VisualStudio.TextTemplating.Engine
命名空間: Microsoft.VisualStudio.TextTemplating
組件: Microsoft.VisualStudio.TextTemplating.12.0 (在 Microsoft.VisualStudio.TextTemplating.12.0.dll 中)
語法
'宣告
Public Class Engine _
Implements ITextTemplatingEngine, IDebugTextTemplatingEngine
public class Engine : ITextTemplatingEngine, IDebugTextTemplatingEngine
public ref class Engine : ITextTemplatingEngine, IDebugTextTemplatingEngine
type Engine =
class
interface ITextTemplatingEngine
interface IDebugTextTemplatingEngine
end
public class Engine implements ITextTemplatingEngine, IDebugTextTemplatingEngine
Engine 類型會公開下列成員。
建構函式
名稱 | 描述 | |
---|---|---|
![]() |
Engine | 初始化 Engine 類別的新執行個體。 |
回頁首
方法
名稱 | 描述 | |
---|---|---|
![]() |
Equals | 判斷指定的物件是否等於目前的物件。 (繼承自 Object)。 |
![]() |
Finalize | 在記憶體回收開始前,允許物件嘗試釋放資源,並執行其他清除作業。 (繼承自 Object)。 |
![]() |
GetHashCode | 做為預設雜湊函式。 (繼承自 Object)。 |
![]() |
GetType | 取得目前實例 Type 的屬性。 (繼承自 Object)。 |
![]() |
MemberwiseClone | 建立目前 Object 的淺層複製 (Shallow Copy) 。 (繼承自 Object)。 |
![]() |
PrepareTransformationRun | 準備一 IDebugTransformationRun 物件執行範本。 |
![]() |
PreprocessTemplate | 產生的範本程式碼,因此,在編譯和執行時,會產生範本輸出。 |
![]() |
ProcessTemplate | 轉換文字範本檔的內容,以產生所產生的文字輸出。 |
![]() |
ToString | 傳回代表目前物件的字串。 (繼承自 Object)。 |
回頁首
欄位
名稱 | 描述 | |
---|---|---|
![]() ![]() |
CacheAssembliesOptionString | CacheAssemblies 選項字串。 |
![]() ![]() |
TemplateFileParameterName |
回頁首
備註
文字範本轉換流程會接受文字範本檔做為輸入並產生新的文字檔做為輸出。 文字範本轉換引擎元件控制流程並與 文字範本轉換主應用程式 互動,而且中的一個或多個文字範本指示詞處理器完成程序。 如需詳細資訊,請參閱程式碼產生和 T4 文字範本。
提示
如果您正在撰寫在 Visual Studio內執行的封裝或擴充功能,請考慮使用文字範本化服務而不是撰寫自己的主應用程式。如需詳細資訊,請參閱叫用 VS 擴充功能中的文字轉換。
範例
下列範例示範如何建立 Engine 的執行個體,並且呼叫 ProcessTemplate 來轉換文字範本。
這個程式碼範例是 ITextTemplatingEngineHost 介面完整範例的一部分。
Engine engine = new Engine();
//read the text template
string input = File.ReadAllText(templateFileName);
//transform the text template
string output = engine.ProcessTemplate(input, host);
Dim engine As Engine = New Engine()
'read the text template
Dim input As String = File.ReadAllText(templateFileName)
'transform the text template
Dim output As String = engine.ProcessTemplate(input, host)
執行緒安全
這個類型的任何 Public static (在 Visual Basic 中為 Shared) 成員都是安全執行緒。不保證任何執行個體成員是安全執行緒。
請參閱
參考
Microsoft.VisualStudio.TextTemplating 命名空間