XhtmlTextWriter コンストラクター

定義

XhtmlTextWriter クラスの新しいインスタンスを初期化します。

オーバーロード

名前 説明
XhtmlTextWriter(TextWriter)

XhtmlTextWriter フィールドで指定された行インデントを使用するDefaultTabString クラスの新しいインスタンスを初期化します。 既定の行インデントを変更しない場合は、 XhtmlTextWriter(TextWriter) コンストラクターを使用します。

XhtmlTextWriter(TextWriter, String)

指定した行インデントを使用して、 XhtmlTextWriter クラスの新しいインスタンスを初期化します。

XhtmlTextWriter(TextWriter)

XhtmlTextWriter フィールドで指定された行インデントを使用するDefaultTabString クラスの新しいインスタンスを初期化します。 既定の行インデントを変更しない場合は、 XhtmlTextWriter(TextWriter) コンストラクターを使用します。

public:
 XhtmlTextWriter(System::IO::TextWriter ^ writer);
public XhtmlTextWriter(System.IO.TextWriter writer);
new System.Web.UI.XhtmlTextWriter : System.IO.TextWriter -> System.Web.UI.XhtmlTextWriter
Public Sub New (writer As TextWriter)

パラメーター

writer
TextWriter

XHTML コンテンツをレンダリングする TextWriter インスタンス。

次のコード例では、HtmlTextWriter クラスから派生したカスタム クラスに対して、XhtmlTextWriter クラスから直接または間接的に派生するすべてのクラスの標準である 2 つのコンストラクターを作成する方法を示します。

// Create a class that inherits from XhtmlTextWriter.
[AspNetHostingPermission(SecurityAction.Demand, 
    Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, 
    Level=AspNetHostingPermissionLevel.Minimal)] 
public class CustomXhtmlTextWriter : XhtmlTextWriter
{
    // Create two constructors, following 
    // the pattern for implementing a
    // TextWriter constructor.
    public CustomXhtmlTextWriter(TextWriter writer) : 
        this(writer, DefaultTabString)
    {
    }

    public CustomXhtmlTextWriter(TextWriter writer, string tabString) : 
        base(writer, tabString)
    {
    }
' Create a class that inherits from XhtmlTextWriter.
<AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class CustomXhtmlTextWriter
    Inherits XhtmlTextWriter

    ' Create two constructors, following 
    ' the pattern for implementing a
    ' TextWriter constructor.
    Public Sub New(writer As TextWriter)
      MyClass.New(writer, DefaultTabString)
    End Sub


    Public Sub New(writer As TextWriter, tabString As String)
      MyBase.New(writer, tabString)
    End Sub

注釈

XhtmlTextWriter オブジェクトをパラメーターとして受け取る TextWriter コンストラクターは、2 番目のコンストラクターを呼び出し、2 つのパラメーター値を渡します。

  • TextWriter のインスタンスです。

  • XHTML テキスト ライターによって使用されるタブの間隔を定義する、 DefaultTabString フィールドで指定された文字列値。

適用対象

XhtmlTextWriter(TextWriter, String)

指定した行インデントを使用して、 XhtmlTextWriter クラスの新しいインスタンスを初期化します。

public:
 XhtmlTextWriter(System::IO::TextWriter ^ writer, System::String ^ tabString);
public XhtmlTextWriter(System.IO.TextWriter writer, string tabString);
new System.Web.UI.XhtmlTextWriter : System.IO.TextWriter * string -> System.Web.UI.XhtmlTextWriter
Public Sub New (writer As TextWriter, tabString As String)

パラメーター

writer
TextWriter

XHTML コンテンツをレンダリングする TextWriter インスタンス。

tabString
String

行インデントのレンダリングに使用される文字列。

次のコード例では、HtmlTextWriter クラスから派生したカスタム クラスに対して、XhtmlTextWriter クラスから直接または間接的に派生するすべてのクラスの標準である 2 つのコンストラクターを作成する方法を示します。

// Create a class that inherits from XhtmlTextWriter.
[AspNetHostingPermission(SecurityAction.Demand, 
    Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, 
    Level=AspNetHostingPermissionLevel.Minimal)] 
public class CustomXhtmlTextWriter : XhtmlTextWriter
{
    // Create two constructors, following 
    // the pattern for implementing a
    // TextWriter constructor.
    public CustomXhtmlTextWriter(TextWriter writer) : 
        this(writer, DefaultTabString)
    {
    }

    public CustomXhtmlTextWriter(TextWriter writer, string tabString) : 
        base(writer, tabString)
    {
    }
' Create a class that inherits from XhtmlTextWriter.
<AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class CustomXhtmlTextWriter
    Inherits XhtmlTextWriter

    ' Create two constructors, following 
    ' the pattern for implementing a
    ' TextWriter constructor.
    Public Sub New(writer As TextWriter)
      MyClass.New(writer, DefaultTabString)
    End Sub


    Public Sub New(writer As TextWriter, tabString As String)
      MyBase.New(writer, tabString)
    End Sub

適用対象