
WriteFile | 383
HttpResponse
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
buffer( )
A Char array argument containing the characters to write to the output
stream.
index
An Integer argument containing the starting point in the Char array from
which to begin writing.
count
An Integer argument containing the number of characters to write.
Example
The example creates an array of Chars, sets the values of the Chars, and then
loops through the array and displays its contents by calling Response.Write:
Sub Page_Load( )
Dim MyChars(2) As Char
Dim MyChar As Char
MyChars(0) = CChar("A")
MyChars(1) = CChar("B")
MyChars(2) = CChar("C")
For Each MyChar in MyChars
Response.Write(MyChar)
Next
End Sub
Notes
As shown above, the Write method in ASP.NET gains a number of new over-
loaded implementations. The above code could also be written by using another
overloaded implementation that accepts an array of Chars, a starting index, and
the count of Chars to write, as follows:
Response.Write(MyChars, 0, 3)
The implementation of the Write method that takes an Object as an argument
takes advantage of the built-in ToString method of the object class to display the
string representation of the object. ToString is inherited by every .NET class and,
by default, returns the namespace and class name of the object’s class. Classes
that wish to send other information ...