<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FLanguage_Basics%2FMain</id>
		<title>Csharp/C Sharp/Language Basics/Main - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FLanguage_Basics%2FMain"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Main&amp;action=history"/>
		<updated>2026-04-29T17:54:35Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Main&amp;diff=756&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Main&amp;diff=756&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Main&amp;diff=757&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/Language_Basics/Main&amp;diff=757&amp;oldid=prev"/>
				<updated>2010-05-26T11:39:48Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Deal with the arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
class SayHello {&lt;br /&gt;
    public static void Main(string[] args) {&lt;br /&gt;
        if (args.Length &amp;gt; 0) {&lt;br /&gt;
            foreach (string arg in args) {&lt;br /&gt;
                if (arg.Equals(&amp;quot;/help&amp;quot;))&lt;br /&gt;
                    Console.WriteLine(&amp;quot;Run this program as follows: sayhello.exe [name1] &amp;quot;);&lt;br /&gt;
                else&lt;br /&gt;
                    Console.WriteLine(&amp;quot;Hello &amp;quot; + &amp;quot;{0}&amp;quot;, arg);&lt;br /&gt;
            }&lt;br /&gt;
        } else&lt;br /&gt;
            Console.WriteLine(&amp;quot;For help, run sayhello.exe /help&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Every console app starts with Main==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Learning C# &lt;br /&gt;
by Jesse Liberty&lt;br /&gt;
Publisher: O&amp;quot;Reilly &lt;br /&gt;
ISBN: 0596003765&lt;br /&gt;
*/&lt;br /&gt;
 namespace NotePad&lt;br /&gt;
 {&lt;br /&gt;
    public class HelloWorld&lt;br /&gt;
    {&lt;br /&gt;
       // every console app starts with Main&lt;br /&gt;
       static void Main()&lt;br /&gt;
       {&lt;br /&gt;
          System.Console.WriteLine(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Main Function: Multiple Mains==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// error &lt;br /&gt;
using System;&lt;br /&gt;
class Complex&lt;br /&gt;
{&lt;br /&gt;
    static int Main()&lt;br /&gt;
    {&lt;br /&gt;
        // test code here&lt;br /&gt;
        Console.WriteLine(&amp;quot;Console: Passed&amp;quot;);&lt;br /&gt;
        return(0);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
public class TheMainFunctionMultipleMains&lt;br /&gt;
{&lt;br /&gt;
    public static void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
        foreach (string arg in args)&lt;br /&gt;
        Console.WriteLine(arg);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Return different value to the operating system based on the argument length==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
class SayHello {&lt;br /&gt;
    public static int Main(string[] args) {&lt;br /&gt;
        if (args.Length &amp;gt; 0) {&lt;br /&gt;
            foreach (string arg in args) {&lt;br /&gt;
                if (arg.Equals(&amp;quot;/help&amp;quot;)) {&lt;br /&gt;
                    Console.WriteLine(&amp;quot;Run this program as follows:&amp;quot; +&lt;br /&gt;
                              &amp;quot;sayhello.exe [name1] &amp;quot;);&lt;br /&gt;
                    return (1);&lt;br /&gt;
                } else&lt;br /&gt;
                    Console.WriteLine(&amp;quot;Hello &amp;quot; + &amp;quot;{0}&amp;quot;, arg);&lt;br /&gt;
            }&lt;br /&gt;
            return (0);&lt;br /&gt;
        } else&lt;br /&gt;
            Console.WriteLine(&amp;quot;For help, run sayhello.exe /help&amp;quot;);&lt;br /&gt;
        return (2);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Static Main function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Learning C# &lt;br /&gt;
by Jesse Liberty&lt;br /&gt;
Publisher: O&amp;quot;Reilly &lt;br /&gt;
ISBN: 0596003765&lt;br /&gt;
*/&lt;br /&gt;
 using System;&lt;br /&gt;
 namespace StaticTester&lt;br /&gt;
 {&lt;br /&gt;
     // create the class&lt;br /&gt;
    public class StaticTester&lt;br /&gt;
    {&lt;br /&gt;
       // Run is an instance method&lt;br /&gt;
       public void Run()&lt;br /&gt;
       {&lt;br /&gt;
           Console.WriteLine(&amp;quot;Hello world&amp;quot;);&lt;br /&gt;
       }&lt;br /&gt;
       // Main is static&lt;br /&gt;
       static void Main()&lt;br /&gt;
       {&lt;br /&gt;
           // create an instance&lt;br /&gt;
           StaticTester t = new StaticTester();&lt;br /&gt;
           // invoke the instance method&lt;br /&gt;
           t.Run();&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Main Function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
public class TheMainFunction&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Console.WriteLine(&amp;quot;Hello, Universe!&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Main Function:Command-Line Parameters==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
public class CommandLineParameters&lt;br /&gt;
{&lt;br /&gt;
    public static void Main(string[] args)&lt;br /&gt;
    {&lt;br /&gt;
        foreach (string arg in args)&lt;br /&gt;
        Console.WriteLine(&amp;quot;Arg: {0}&amp;quot;, arg);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Main Function:Returning an Int Status==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
public class ReturninganIntStatus&lt;br /&gt;
{&lt;br /&gt;
    public static int Main()&lt;br /&gt;
    {&lt;br /&gt;
        Console.WriteLine(&amp;quot;Hello, Universe!&amp;quot;);&lt;br /&gt;
        return(0);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==This is a simple C# program==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C#: The Complete Reference &lt;br /&gt;
by Herbert Schildt &lt;br /&gt;
Publisher: Osborne/McGraw-Hill (March 8, 2002)&lt;br /&gt;
ISBN: 0072134852&lt;br /&gt;
*/&lt;br /&gt;
/*  &lt;br /&gt;
   This is a simple C# program. &lt;br /&gt;
 &lt;br /&gt;
   Call this program Example.cs. &lt;br /&gt;
*/ &lt;br /&gt;
 &lt;br /&gt;
using System; &lt;br /&gt;
 &lt;br /&gt;
public class ExampleWriteLine { &lt;br /&gt;
 &lt;br /&gt;
  // A C# program begins with a call to Main(). &lt;br /&gt;
  public static void Main() { &lt;br /&gt;
    Console.WriteLine(&amp;quot;A simple C# program.&amp;quot;); &lt;br /&gt;
  } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using command-line arguments to initialize an array.==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
public class InitArray&lt;br /&gt;
{&lt;br /&gt;
   public static void Main( string[] args )&lt;br /&gt;
   {&lt;br /&gt;
         int arrayLength = Convert.ToInt32( args[ 0 ] );&lt;br /&gt;
         int[] array = new int[ arrayLength ]; // create array&lt;br /&gt;
         int initialValue = Convert.ToInt32( args[ 1 ] );&lt;br /&gt;
         int increment = Convert.ToInt32( args[ 2 ] );&lt;br /&gt;
         for ( int counter = 0; counter &amp;lt; array.Length; counter++ )&lt;br /&gt;
            array[ counter ] = initialValue + increment * counter;&lt;br /&gt;
         Console.WriteLine( &amp;quot;{0}{1,8}&amp;quot;, &amp;quot;Index&amp;quot;, &amp;quot;Value&amp;quot; );&lt;br /&gt;
         for ( int counter = 0; counter &amp;lt; array.Length; counter++ )&lt;br /&gt;
            Console.WriteLine( &amp;quot;{0,5}{1,8}&amp;quot;, counter, array[ counter ] );&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
  &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Variations on the Main() Method==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
/*&lt;br /&gt;
The previous iteration of Main() was defined to take a single parameter (an array of strings) and return an integer data type. This is not the only possible form of Main(), however. It is permissible to construct your application&amp;amp;iexcl;�s entry point using any of the following signatures (assuming it is contained within a C# class or structure definition):&lt;br /&gt;
// No return type, array of strings as argument. &lt;br /&gt;
public static void Main(string[] args) &lt;br /&gt;
{ &lt;br /&gt;
} &lt;br /&gt;
// No return type, no arguments. &lt;br /&gt;
public static void Main() &lt;br /&gt;
{ &lt;br /&gt;
} &lt;br /&gt;
// Integer return type, no arguments. &lt;br /&gt;
public static int Main() &lt;br /&gt;
{ &lt;br /&gt;
} &lt;br /&gt;
*/&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>