⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx

📁 Other things about csharp. you could learn from this
💻 ASPX
字号:
<%@ Page Trace="false" Language="C#" debug="true" %>

<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.IO" %>

<H2>TextWriter</H2>

<script runat=server>

	protected void WriteContentsToResponse( TextReader r )
	{
		string line;

		line = r.ReadLine();

		while ( line != null )
		{
			Response.Write(line);
			Response.Write( "<BR>" );
			line = r.ReadLine();
		}

	}

</script>


<%

TextWriter tw;

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

<%
	string text;

	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>

<%
	string fileToRead;
	StreamReader sr;


	fileToRead = Server.MapPath("myfile.txt" );

	sr = File.OpenText( fileToRead );

	WriteContentsToResponse(sr);
	sr.Close();
	

%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -