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

📄 simple welcome program.htm

📁 点net代码20个
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Simple Welcome Program</title>
</head>

<body background="../basic3.gif">

<p align="center"><font color="#FF0000" size="4"><b>Simple Welcome Program</b></font></p>

<table border="0" cellspacing="0" width="596">
  <tr>
    <td><font color="#008000">// Namespace Declaration<br>
      using System;<br>
      <br>
      // Program start class<br>
      class WelcomeCSS {<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Main begins program 
      execution.<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static void Main() {<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 
      Write to console<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      Console.WriteLine(&quot;Welcome to the C# Station Tutorial!&quot;);&nbsp;<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
      }</font></td>
  </tr>
  <tr>
    <td>The program in Listing 1-1 has 4 primary elements, a namespace 
      declaration, a class, a &quot;Main&quot; method, and a program statement.</td>
  </tr>
  <tr>
    <td>The namespace declaration indicates that you are referencing the 
      &quot;System&quot; namespace.&nbsp; Namespaces contain groups of code that 
      can be called upon by C# programs.&nbsp; With the &quot;using 
      System;&quot; declaration, you are telling your program that it can 
      reference the code in the &quot;System&quot; namespace without pre-pending 
      the word &quot;System&quot; to every reference.&nbsp; I'll discuss this in 
      more detail in a later lesson, dedicated specifically to namespaces.</td>
  </tr>
  <tr>
    <td>The class declaration, &quot;class WelcomeCSS&quot;, contains the data 
      and method definitions that your program uses to execute.&nbsp; It is one 
      of a few different types of elements your program can use to describe 
      objects, such as&nbsp; interfaces and structures, which will be discussed 
      in more detail in a later lesson.&nbsp; This particular class has no data, 
      but it does have one method.&nbsp; This method defines the behavior of 
      this class (or what it is capable of doing).</td>
  </tr>
  <tr>
    <td>The one method within the WelcomeCSS class tells what this class will do 
      when executed.&nbsp; The method name, &quot;Main&quot;, is reserved for 
      the starting point of a program.&nbsp; Before the word &quot;Main&quot; is 
      a &quot;static&quot; modifier.&nbsp; The &quot;static&quot; modifier 
      explains that this method works in this specific class only, rather than 
      an instance of the class.&nbsp; This is necessary, because when a program 
      begins, no object instances exist.&nbsp; Classes, objects, and instances 
      will be covered in more detail in a later lesson. Every method must have a 
      return type.&nbsp; In this case it is &quot;void&quot;, which means that 
      &quot;Main&quot; does not return a value.&nbsp; Every method also has a 
      parameter list following it's name with zero or more parameters between 
      parenthesis.&nbsp; For simplicity, we did not add parameters to 
      &quot;Main&quot;.&nbsp; Later in this lesson we'll show what type of 
      parameter the &quot;Main&quot; method can have.</td>
  </tr>
  <tr>
    <td>The &quot;Main&quot; method specifies it's behavior with the &quot;Console.WriteLine(...)&quot; 
      statement.&nbsp; &quot;Console&quot; is a class in the &quot;System&quot; 
      namespace.&nbsp; &quot;WriteLine(...)&quot; is a method in the 
      &quot;Console&quot; class.&nbsp; We use the &quot;.&quot;, dot, operator 
      to separate subordinate program elements.&nbsp; It should be interesting 
      to note that we could also write this statement as &quot;System.Console.WriteLine(...)&quot;.&nbsp; 
      This follows the pattern &quot;namespace.class.method&quot; as a fully 
      qualified statement.&nbsp; Had we left out the &quot;using System&quot; 
      declaration at the top of the program, it would have been mandatory for us 
      to use the fully qualified form &quot;System.Console.WriteLine(...)&quot;.&nbsp; 
      This statement is what causes the string, &quot;Welcome to the C# Station 
      Tutorial!&quot; to print on the console screen.</td>
  </tr>
  <tr>
    <td>Observe that comments are marked with &quot;//&quot;.&nbsp; These are 
      single line comments, meaning that they are valid until the end-of-line.&nbsp; 
      If you wish to span multiple lines with a comment, begin with 
      &quot;/*&quot; and end with &quot;*/&quot;.&nbsp; Everything in between is 
      part of the comment.&nbsp; You may place a single line comment within a 
      multi-line comment.&nbsp; However, you can't put multi-line comments 
      within a multi-line comment.&nbsp; Comments are not considered when your 
      program is compiled.&nbsp; They are there to document what your program 
      does in plain english.&nbsp;&nbsp;</td>
  </tr>
  <tr>
    <td>All statements end with a &quot;;&quot;, semi-colon.&nbsp; Classes and 
      methods begin with &quot;{&quot;, left curly brace, and end with a 
      &quot;}&quot;, right curly brace.&nbsp; Any statements within and 
      including &quot;{&quot; and &quot;}&quot; define a block.&nbsp; Blocks 
      define scope (or lifetime and visibility) of program elements, which will 
      be discussed in a later lesson.</td>
  </tr>
  <tr>
    <td>Many programs are written to accept command-line input.&nbsp; Collection 
      of command-line input occurs in the &quot;Main&quot; method.&nbsp; Listing 
      1-2 shows a program which accepts a name from the command line and writes 
      it to the console.</td>
  </tr>
</table>

</body>

</html>

⌨️ 快捷键说明

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