csharp_basic concepts.md - brainchildservices/curriculum GitHub Wiki

SLIDE-1

  • Application Startup
    • Application startup occurs when the execution environment calls a designated method, which is referred to as the application's entry point.

    • This entry point method is always named Main, and can have one of the following signatures:

                 static void Main() {...}
      
                 static void Main(string[] args) {...}
      
                 static int Main() {...}
      
                 static int Main(string[] args) {...}
      

SLIDE-1(DOWNWARDS)

  • As shown, the entry point may optionally return an int value. This return value is used in application termination

    • An assembly that has an entry point is called an application.
    • When an application is run, a new application domain is created. Several different instantiations of an application may exist on the same machine at the same time, and each has its own application domain.
    • The entry point may optionally have one formal parameter. The parameter may have any name, but the type of the parameter must be string[ ].

SLIDE-2

  • Application termination
    • Application termination returns control to the execution environment.
    • If the return type of the application's entry point method is int, the value returned serves as the application's termination status code. The purpose of this code is to allow communication of success or failure to the execution environment.
    • If the return type of the entry point method is void, reaching the right brace (}) which terminates that method, or executing a return statement that has no expression, results in a termination status code of 0.

SLIDE-3

  • Declaration
    • Declarations in a C# program define the constituent elements of the program.
    • C# programs are organized using namespaces (Namespaces), which can contain type declarations and nested namespace declarations.
    • Type declarations (Type declarations) are used to define classes (Classes), structs (Structs), interfaces (Interfaces), enums (Enums), and delegates (Delegates). The kinds of members permitted in a type declaration depend on the form of the type declaration.

SLIDE-3(DOWNWARDS)

  • A declaration defines a name in the declaration space to which the declaration belongs.

    • Within all source files of a program, namespace_member_declarations with no enclosing namespace_declaration are members of a single combined declaration space called the global declaration space.
    • Within all source files of a program, namespace_member_declarations within namespace_declarations that have the same fully qualified namespace name are members of a single combined declaration space.
  • REF Link: