แก้ไข

แชร์ผ่าน


HtmlTextWriter.SpaceChar Field

Definition

Represents a space ( ) character.

public: char SpaceChar;
public const char SpaceChar;
val mutable SpaceChar : char
Public Const SpaceChar As Char 

Field Value

Examples

This section provides two code examples. The first one demonstrates how to create a character array. The second one demonstrates how to use the array.

These code examples generate the following markup:

<label>

hello world

</label>

The following code example shows how to create a Char array that contains the SpaceChar field.

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}

The following code example shows how to use the array that was created in the preceding code example as a parameter when calling the Write method.

// 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()

Remarks

The SpaceChar field is used by the RenderBeginTag and WriteAttribute methods when writing separators between elements and attributes.

Applies to

See also