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

📄 ch7_01.cs

📁 《c#技术内幕代码》
💻 CS
字号:
using System; // For the Console definition
using System.IO; // For TextWriter definition

class ATestClass
{
   private int x;
   private double y;
   private string s;
   
   public ATestClass()
   {
      x = 10;
      y = 23.45;
      s = "ATestClass Information";
   }
   public void Dump(TextWriter o)
   {
      o.WriteLine("X = {0}", x );
      o.WriteLine("Y = {0}", y );
      o.WriteLine("S = {0}", s );
   }
}


class CH7_1
{
   public static void Main()
   {
      // Output a few things to the console
      Console.WriteLine("This is a test");
      Console.WriteLine("This is an integer: {0}", 1 );
      
      ATestClass test = new ATestClass();
      Console.WriteLine("This is an object: {0}", test );
      Console.WriteLine("This is a dump of an object:");
      test.Dump( Console.Out );
      
      // Get input from the user until they say "End"
      Boolean done = false;
      while ( !done )
      {
         string s = Console.ReadLine();
	 if ( s == "End" )
	    break;
      }
      
      // Output things without a line break
      Console.Write("This");
      Console.Write(" ");
      Console.Write("is");
      Console.Write(" ");
      Console.Write("a");
      Console.Write(" ");
      Console.Write("test");
   }
}

⌨️ 快捷键说明

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