다음을 통해 공유


TextTransformation Class

The abstract base class for all generated transformation classes. This class also provides utility methods and properties for use in text template code.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.TextTemplating.TextTransformation
    Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation

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

Syntax

'Declaration
Public MustInherit Class TextTransformation _
    Implements IDisposable
public abstract class TextTransformation : IDisposable
public ref class TextTransformation abstract : IDisposable
[<AbstractClass>]
type TextTransformation =  
    class 
        interface IDisposable 
    end
public abstract class TextTransformation implements IDisposable

The TextTransformation type exposes the following members.

Constructors

  Name Description
Protected method TextTransformation Initializes a new instance of the TextTransformation class.

Top

Properties

  Name Description
Public property CurrentIndent Gets the current indent text, which is prefixed to each line of the generated text output.
Public property Errors Infrastructure. Gets the error collection for the text template transformation process.
Protected property GenerationEnvironment Gets or sets the string that the text template transformation process is using to assemble the generated text output.
Public property Session Gets or sets the current session. A session represents a series of transformations that are executed within the same user command. The session object can be used to transmit information into the code of a text template.

Top

Methods

  Name Description
Public method ClearIndent Resets the CurrentIndent to an empty string.
Public method Dispose() Releases all resources used by the TextTransformation.
Protected method Dispose(Boolean) Releases the unmanaged resources used by the TextTransformation and optionally releases the managed resources.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method Error Creates a new error to store information about errors that occur during the text template transformation process.
Protected method Finalize Allows an Object to attempt to free resources and perform other cleanup operations before it is reclaimed by the garbage collector. Called by the garbage collector. (Overrides Object.Finalize().)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Initialize Infrastructure. Initializes the TextTransformation class.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method PopIndent Removes the most recently added text from CurrentIndent.
Public method PushIndent Adds text to CurrentIndent, which is prefixed to each line of the generated text output.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method TransformText When overridden in a derived class, generates the text output of the transformation.
Public method Warning Creates a new warning to store information about errors that occur during the text template transformation process.
Public method Write(String) Appends a copy of the specified string to the generated text output.
Public method Write(String, array<Object[]) Appends a formatted string, which contains zero or more format specifications, to the generated text output. Each format specification is replaced by the string representation of a corresponding object argument.
Public method WriteLine(String) Appends a copy of the specified string and the default line terminator to the generated text output.
Public method WriteLine(String, array<Object[]) Appends a formatted string, which contains zero or more format specifications, and the default line terminator, to the generated text output. Each format specification is replaced by the string representation of a corresponding object argument.

Top

Remarks

The text template transformation process has two steps. In the first step, the text template transformation engine creates a class that is referred to as the generated transformation class. In the second step, the engine compiles and executes the generated transformation class, to produce the generated text output. The generated transformation class inherits from TextTransformation.

Any class specified in an inherits directive in a text template must itself inherit from TextTransformation. TransformText is the only abstract member of this class.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.TextTemplating Namespace

Other Resources

Code Generation and T4 Text Templates