HtmlTextWriter.Write 메서드

정의

보류 중인 탭 공백과 함께 지정된 데이터 형식을 출력 스트림에 씁니다.

오버로드

Write(Boolean)

보류 중인 탭 공백과 함께 부울 값의 텍스트 표현을 출력 스트림에 씁니다.

Write(Char)

보류 중인 탭 공백과 함께 유니코드 문자의 텍스트 표현을 출력 스트림에 씁니다.

Write(Char[])

보류 중인 탭 공백과 함께 유니코드 문자 배열의 텍스트 표현을 출력 스트림에 씁니다.

Write(Double)

보류 중인 탭 공백과 함께 배정밀도 부동 소수점 숫자의 텍스트 표현을 출력 스트림에 씁니다.

Write(Int32)

보류 중인 탭 공백과 함께 32바이트 부호 있는 정수의 텍스트 표현을 출력 스트림에 씁니다.

Write(Int64)

보류 중인 탭 공백과 함께 64바이트 부호 있는 정수의 텍스트 표현을 출력 스트림에 씁니다.

Write(Object)

보류 중인 탭 공백과 함께 개체의 텍스트 표현을 출력 스트림에 씁니다.

Write(Single)

보류 중인 탭 공백과 함께 단정밀도 부동 소수점 숫자의 텍스트 표현을 출력 스트림에 씁니다.

Write(String)

보류 중인 탭 공백과 함께 지정된 문자열을 출력 스트림에 씁니다.

Write(String, Object)

Format(String, Object) 메서드와 동일한 의미 체계를 사용하여 보류 중인 탭 공백과 함께 탭 문자열과 형식이 지정된 문자열을 출력 스트림에 씁니다.

Write(String, Object[])

보류 중인 탭 공백과 함께 개체 배열의 텍스트 표현이 포함된 형식이 지정된 문자열을 출력 스트림에 씁니다. 이 메서드에서는 Format(String, Object[]) 메서드와 동일한 의미 체계를 사용합니다.

Write(Char[], Int32, Int32)

보류 중인 탭 공백과 함께 유니코드 문자 하위 배열의 텍스트 표현을 출력 스트림에 씁니다.

Write(String, Object, Object)

보류 중인 탭 공백과 함께 두 개체의 텍스트 표현이 포함된 형식이 지정된 문자열을 출력 스트림에 씁니다. 이 메서드에서는 Format(String, Object, Object) 메서드와 동일한 의미 체계를 사용합니다.

Write(Boolean)

보류 중인 탭 공백과 함께 부울 값의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(bool value);
public override void Write (bool value);
override this.Write : bool -> unit
Public Overrides Sub Write (value As Boolean)

매개 변수

value
Boolean

출력 스트림에 쓸 Boolean입니다.

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(Char)

보류 중인 탭 공백과 함께 유니코드 문자의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(char value);
public override void Write (char value);
override this.Write : char -> unit
Public Overrides Sub Write (value As Char)

매개 변수

value
Char

출력 스트림에 쓸 유니코드 문자입니다.

예제

다음 코드 예제에서는 메서드를 Write 사용하여 상수를 사용하여 요소의 여는 태그를 <img> 종료하는 방법을 TagRightChar 보여 줍니다.

이 코드 예제에서는 다음 태그를 렌더링합니다.

<img alt="A custom image">

</img>

// Create a manually rendered <img> element
// that contains an alt attribute.
writer.WriteBeginTag("img");
writer.WriteAttribute("alt", "A custom image.");
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag("img");
' Create a manually rendered <img> element
' that contains an alt attribute.
writer.WriteBeginTag("img")
writer.WriteAttribute("alt", "A custom image.")
writer.Write(HtmlTextWriter.TagRightChar)
writer.WriteEndTag("img")

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(Char[])

보류 중인 탭 공백과 함께 유니코드 문자 배열의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(cli::array <char> ^ buffer);
public override void Write (char[] buffer);
override this.Write : char[] -> unit
Public Overrides Sub Write (buffer As Char())

매개 변수

buffer
Char[]

출력 스트림에 쓸 유니코드 문자 배열입니다.

예제

이 섹션에서는 두 코드 예제를 제공합니다. 첫 번째는 문자 배열을 만드는 방법을 보여 줍니다. 두 번째는 배열을 사용하는 방법을 보여 줍니다.

이러한 코드 예제는 다음 태그를 생성합니다.

<label>

hello world

</label>

다음 코드 예제에서는 철자 문자 배열을 만드는 방법을 보여 줍니다 hello world. 배열에 포함된 필드는 SpaceChar 두 단어 사이에 공백을 만듭니다.

private char[] testChars = {'h', 'e', 'l', 'l', 'o',
    HtmlTextWriter.SpaceChar ,'w', 'o', 'r', 'l', 'd'};
Private testChars() As Char = _
    {"h"c, "e"c, "l"c, "l"c, "o"c, _
    HtmlTextWriter.SpaceChar, "w"c, "o"c, "r"c, "l"c, "d"c}

다음 코드 예제에서는 메서드를 사용 하 여 Write 렌더링 하는 hello world 방법에 설명 합니다 이전 코드 예제에서 만든 문자 배열을 렌더링 하는 경우 페이지에이 예제 코드를 포함 하는 컨트롤이 페이지에 포함 되어 있습니다.

// Render a character array as the 
// contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write(testChars);
writer.RenderEndTag();
' Render a character array as the 
' contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.Write(testChars)
writer.RenderEndTag()

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(Double)

보류 중인 탭 공백과 함께 배정밀도 부동 소수점 숫자의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(double value);
public override void Write (double value);
override this.Write : double -> unit
Public Overrides Sub Write (value As Double)

매개 변수

value
Double

출력 스트림에 쓸 배정밀도 부동 소수점 숫자입니다.

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 Write 필드의 Double.MaxValue 값을 렌더링 하는 방법입니다.

이 코드 예제에서는 다음 태그를 생성합니다.

<label>

1.79769313486232E+308

</label>

// Use the Write(Double) method to render
// the MaxValue field of the Double structure. 
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write(Double.MaxValue);
writer.RenderEndTag();
' Use the WriteLine(Double) method to render
' the MaxValue field of the Double structure. 
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.WriteLine(Double.MaxValue)
writer.RenderEndTag()

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(Int32)

보류 중인 탭 공백과 함께 32바이트 부호 있는 정수의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(int value);
public override void Write (int value);
override this.Write : int -> unit
Public Overrides Sub Write (value As Integer)

매개 변수

value
Int32

출력 스트림에 쓸 32바이트 부호 있는 정수입니다.

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(Int64)

보류 중인 탭 공백과 함께 64바이트 부호 있는 정수의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(long value);
public override void Write (long value);
override this.Write : int64 -> unit
Public Overrides Sub Write (value As Long)

매개 변수

value
Int64

출력 스트림에 쓸 64바이트 부호 있는 정수입니다.

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(Object)

보류 중인 탭 공백과 함께 개체의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(System::Object ^ value);
public override void Write (object value);
override this.Write : obj -> unit
Public Overrides Sub Write (value As Object)

매개 변수

value
Object

출력 스트림에 쓸 개체입니다.

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 Write 메서드의 값을 렌더링 하는 CultureInfo.CurrentCulture 속성입니다.

이 코드 예제에서는 다음 태그를 생성합니다.

This is a rendered CultureInfo object.

<bold>

속성의 CurrentCulture 값입니다.

</bold>

// Use the Write method to render an arbitrary
// object, in this case a CultureInfo object. 
writer.Write("This is a rendered CultureInfo Object.");
writer.RenderBeginTag(HtmlTextWriterTag.B);
writer.Write(CultureInfo.CurrentCulture);
writer.RenderEndTag();
' Use the Write method to render an arbitrary
' object, in this case a CultureInfo object.
writer.Write("This is a rendered CultureInfo Object.")
writer.RenderBeginTag(HtmlTextWriterTag.B)
writer.Write(CultureInfo.CurrentCulture)
writer.RenderEndTag()

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(Single)

보류 중인 탭 공백과 함께 단정밀도 부동 소수점 숫자의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(float value);
public override void Write (float value);
override this.Write : single -> unit
Public Overrides Sub Write (value As Single)

매개 변수

value
Single

출력 스트림에 쓸 단정밀도 부동 소수점 숫자입니다.

예제

다음 코드 예제를 사용 Write 하는 방법을 보여 줍니다는 구조체의 Single.Epsilon 가능한 가장 작은 값인 필드의 값을 렌더링 하는 Single 방법입니다.

이 코드 예제에서는 다음 태그를 생성합니다.

<b>

1.401298E-45

</b>

// Use the Write(Single) method to render the
// Epsilon field of the Single structure. 
writer.RenderBeginTag(HtmlTextWriterTag.B);
writer.Write(Single.Epsilon);
writer.RenderEndTag();
' Use the Write(Single) method to render the
' Epsilon field of the Single structure. 
writer.RenderBeginTag(HtmlTextWriterTag.B)
writer.Write(Single.Epsilon)
writer.RenderEndTag()

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(String)

보류 중인 탭 공백과 함께 지정된 문자열을 출력 스트림에 씁니다.

public:
 override void Write(System::String ^ s);
public override void Write (string s);
override this.Write : string -> unit
Public Overrides Sub Write (s As String)

매개 변수

s
String

출력 스트림에 쓸 문자열입니다.

예제

다음 코드 예제를 사용 Write 하는 방법에 설명 합니다 메서드를 사용자 지정 태그의 여는 태그와 닫는 태그 사이 문자열을 렌더링 합니다.

이 코드 예제에서는 다음 태그를 생성합니다.

<MyTag>

Contents of MyTag

</MyTag>

// Create a non-standard tag.
writer->RenderBeginTag( "MyTag" );
writer->Write( "Contents of MyTag" );
writer->RenderEndTag();
writer->WriteLine();
// Create a non-standard tag.
writer.RenderBeginTag("MyTag");
writer.Write("Contents of MyTag");
writer.RenderEndTag();
writer.WriteLine();
' Create a non-standard tag.
writer.RenderBeginTag("MyTag")
writer.Write("Contents of MyTag")
writer.RenderEndTag()
writer.WriteLine()

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(String, Object)

Format(String, Object) 메서드와 동일한 의미 체계를 사용하여 보류 중인 탭 공백과 함께 탭 문자열과 형식이 지정된 문자열을 출력 스트림에 씁니다.

public:
 override void Write(System::String ^ format, System::Object ^ arg0);
public override void Write (string format, object arg0);
override this.Write : string * obj -> unit
Public Overrides Sub Write (format As String, arg0 As Object)

매개 변수

format
String

0개 이상의 형식 항목을 포함하는 문자열입니다.

arg0
Object

서식을 지정할 개체입니다.

예제

다음 코드 예제를 사용 Write 하는 방법에 설명 합니다 형식이 지정된 문자열을 렌더링 하는 메서드는 값이 CurrentCulture 속성입니다.

// Use the Write(string, object) method to
// render a formatted string and an object in it.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write("The current cultural settings are {0}",
    CultureInfo.CurrentCulture);
writer.RenderEndTag();
' Use the Write(string, object) method to
' render a formatted string and an object in it.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.Write("The current cultural settings are {0}.", _
    CultureInfo.CurrentCulture)
writer.RenderEndTag()

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(String, Object[])

보류 중인 탭 공백과 함께 개체 배열의 텍스트 표현이 포함된 형식이 지정된 문자열을 출력 스트림에 씁니다. 이 메서드에서는 Format(String, Object[]) 메서드와 동일한 의미 체계를 사용합니다.

public:
 override void Write(System::String ^ format, ... cli::array <System::Object ^> ^ arg);
public override void Write (string format, params object[] arg);
override this.Write : string * obj[] -> unit
Public Overrides Sub Write (format As String, ParamArray arg As Object())

매개 변수

format
String

0개 이상의 형식 항목을 포함하는 문자열입니다.

arg
Object[]

형식을 지정할 개체 배열입니다.

예제

이 섹션에는 두 코드 예제가 있습니다. 첫 번째는 서식이 지정된 문자열과 배열의 내용을 렌더링하는 방법을 보여 줍니다. 두 번째는 배열을 선언하는 방법을 보여 줍니다.

다음 코드 예제를 사용 Write 하는 방법을 보여 줍니다는 형식이 지정된 문자열 및 라는 개체 배열 curPriceTime의 내용을 렌더링 하는 메서드입니다. 메서드 호출은 첫 번째 멤버를 렌더링하기 전에 배열의 두 번째 멤버를 렌더링합니다.

// Render a formatted string and the
// text representation of an object array,
// myObjectArray, as the contents of
// a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write("The trade value at {1} is ${0}.", curPriceTime);
writer.RenderEndTag();
' Render a formatted string and the
' text representation of an object array,
' myObjectArray, as the contents of
' a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.Write("The trade value at {1} is ${0}.", curPriceTime)
writer.RenderEndTag()

다음 코드 예제에서는 개체 배열을 선언하는 방법을 curPriceTime 보여 줍니다.

private object[] curPriceTime = {4.25, DateTime.Now};
Private curPriceTime() As Object = {4.25, DateTime.Now}

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(Char[], Int32, Int32)

보류 중인 탭 공백과 함께 유니코드 문자 하위 배열의 텍스트 표현을 출력 스트림에 씁니다.

public:
 override void Write(cli::array <char> ^ buffer, int index, int count);
public override void Write (char[] buffer, int index, int count);
override this.Write : char[] * int * int -> unit
Public Overrides Sub Write (buffer As Char(), index As Integer, count As Integer)

매개 변수

buffer
Char[]

출력 스트림에 쓸 텍스트가 포함된 문자의 배열입니다.

index
Int32

쓰기를 시작할 배열의 인덱스 위치입니다.

count
Int32

출력 스트림에 쓸 문자 수입니다.

예제

이 섹션에서는 두 코드 예제를 제공합니다. 첫 번째는 문자 배열을 만드는 방법을 보여 줍니다. 두 번째는 배열을 사용하는 방법을 보여 줍니다.

이러한 코드 예제는 다음 태그를 생성합니다.

<label>

hello

</label>

다음 코드 예제에서는 철자 hello world가 인 문자 배열을 만드는 방법을 보여줍니다. 배열에 포함된 필드는 SpaceChar 두 단어 사이에 공백을 만듭니다.

private char[] testChars = {'h', 'e', 'l', 'l', 'o',
    HtmlTextWriter.SpaceChar ,'w', 'o', 'r', 'l', 'd'};
Private testChars() As Char = _
    {"h"c, "e"c, "l"c, "l"c, "o"c, _
    HtmlTextWriter.SpaceChar, "w"c, "o"c, "r"c, "l"c, "d"c}

코드 예제의 다음 부분은 메서드의 및 count 매개 변수를 Write 사용하여 index 이전 예제에서 만든 배열의 처음 5자를 렌더링합니다.

// Render a subarray of a character array
// as the contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write(testChars, 0, 5);
writer.RenderEndTag();
' Render a subarray of a character array
' as the contents of a <label> element.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.Write(testChars, 0, 5)
writer.RenderEndTag()

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상

Write(String, Object, Object)

보류 중인 탭 공백과 함께 두 개체의 텍스트 표현이 포함된 형식이 지정된 문자열을 출력 스트림에 씁니다. 이 메서드에서는 Format(String, Object, Object) 메서드와 동일한 의미 체계를 사용합니다.

public:
 override void Write(System::String ^ format, System::Object ^ arg0, System::Object ^ arg1);
public override void Write (string format, object arg0, object arg1);
override this.Write : string * obj * obj -> unit
Public Overrides Sub Write (format As String, arg0 As Object, arg1 As Object)

매개 변수

format
String

0개 이상의 형식 항목을 포함하는 문자열입니다.

arg0
Object

서식을 지정할 개체입니다.

arg1
Object

서식을 지정할 개체입니다.

예제

다음 코드 예제를 사용 Write 하는 방법에 설명 합니다 형식이 지정된 문자열 및 값을 CurrentCulture 렌더링 하는 메서드 및 Today 속성입니다.

// Use the Write(string,object,object) method to
// render a formatted string and two objects 
// in the string.
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write("The current cultural settings are {0}. Today's date is {1}.",
    CultureInfo.CurrentCulture, DateTime.Today);
writer.RenderEndTag();
' Use the Write(string,object,object) method to
' render a formatted string and two objects 
' in the string.
writer.RenderBeginTag(HtmlTextWriterTag.Label)
writer.Write("The current cultural settings are {0}. Today's date is {1}.", _
    CultureInfo.CurrentCulture, DateTime.Today)
writer.RenderEndTag()

설명

메서드는 Write 보류 중인 모든 탭을 생성한 다음 기본 메서드를 호출합니다 Write .

추가 정보

적용 대상