📄 default.aspx
字号:
<%@ Page Trace="true" Language="VB" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.IO" %>
<H2>TextWriter</H2>
<script runat=server>
Protected Sub WriteContentsToResponse( r As TextReader )
Dim line As String
line = r.ReadLine()
While Not ( line Is Nothing )
Response.Write(line)
Response.Write( "<BR>" )
line = r.ReadLine()
End While
End Sub
</script>
<%
Dim tw As TextWriter
' Uncomment this to remove error (shows you can not create text writer class)
'tw = New TextWriter()
%>
<H3>Reading a String using TextReader</H3>
<P>The following lines are read from a string using StringReader :<BR><BR>
<%
Dim text As String
text = "A\nString\nContaining\nMultiple\nLines"
WriteContentsToResponse( new StringReader(text))
%>
<H3>Reading a File using TextReader</H3>
<P>The following lines are reader from a file using File using StreamReader :<BR><BR>
<%
Dim fileToRead As String
Dim sr As StreamReader
fileToRead = Server.MapPath("..\myfile.txt" )
sr = File.OpenText( fileToRead )
WriteContentsToResponse(sr)
sr.Close()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -