Cs01 Into Framework Labs

65
 1 Catalog Description Object Oriented Programming (OOP) and its efective design will be the major ocus o this course. Encapsulation inheritance and pol!morphism are the "e! components o OOP to be emphasi#ed. $he language %icroso t .&et 'ramewor" C will be introduced and reviewed to an intermediate level. ide b! side comparisons o both C** and C will be part o this hands on course. $he efective use o C** pointers will be covered. $he concepts o multithreaded programming will be e+plored using C.

description

C# programing textbook

Transcript of Cs01 Into Framework Labs

  • Catalog DescriptionObject Oriented Programming (OOP) and its effective design will be the major focus of this course. Encapsulation, inheritance and polymorphism are the key components of OOP to be emphasized. The language Microsoft .Net Framework C# will be introduced and reviewed to an intermediate level. Side by side comparisons of both C++ and C# will be part of this hands on course. The effective use of C++ pointers will be covered. The concepts of multithreaded programming will be explored using C#.

  • TextRequired TextbookVisual C# 2008 How to Program, 3rd edition by Deitel.Pearson / Prentice Hall. ISBN-13: 978-0-13-605322-4Recommended but optional Textbook The Complete Reference by Herbert Schildt. McGraw Hill / Osborne. ISBN 0-07-226209-5

  • Course Objectives- Major Focus is C#Major Focus - C# Language, not C# 3.0 syntaxC# language syntax, types (reference and value), boxing, unboxingObject Oriented ProgrammingScope of objects, passing parameters, overloading methods and constructors, operator overloading.Encapsulation, inheritance and polymorphism, abstract classes, interfacesDifferences between structs and classes and their usageException Handling, including custom Exception HandlingDelegates and eventsThreads and synchronizationUse of streams for files and to interact with networks and the webUse of Debugging ToolsGraphicsUser Interface Design (an introduction)Introduction to XML, ADO .NET, ASP .NET and Web Services

  • Course ObjectivesC++ Main TopicsOOP In C++ (major focus)Pointers (major focus)Linked List with use of pointers (???)Overloading (methods and operators)Exception handlingRecursion (some coverage of the concept)Templates (basic understanding)STL (basic understanding)UML (If time permits, some basic understanding)

  • Syllabus Location of all materialhttp://nhti.nhti.edu ask instructor for username & pwd

    Is this course for you?Goals & OutcomesCourse requirementsReading & workloadExamsQuizzesIn-class programming assignmentProgramming assignmentsGrades

  • SyllabusRead the following. It is in the syllabus documentSchool PoliciesLate workAbsencesAcademic honestyDisruptive behaviorDisabilitiesClass Cancellation

    Class ScheduleSubject to change

  • Introduction to C# Programming LanguageC# (Pronounced C sharp)Introduced by Microsoft in 2000 and its chief architect is Anders Hejlsberg. He called it a component-oriented languageIt is an object-oriented programming language, very similar to Java and C++. For GUI development, very similar to VBC# combines the high productivity of Rapid Application Development (RAD) languages and the raw power of C++

    Visual C#.NET Microsoft's C# development tool or IDE. Includes an interactive development environment, visual designers for building Windows and Web applications, a compiler, and a debugger.Part of a suite of products, called Visual Studio.NET, that also includes Visual Basic.NET, Visual C++.NET, and the JScript scripting language.

  • Introduction to C# Programming LanguageComponent-Oriented languageC# is considered as a Component-Oriented language

    What is a Component?A binary unit of deploymentUsually composed of many objects and is language independentUnlike an object which exists at run-time, components are binaries and are deployedCombines with other components or assemblies to form an applicationImplements one or more well-defined interfacesHas properties, methods, events, attributes

  • Introduction to C# Programming LanguageFeatures worth mentioning.NET environmentEase of development and deploymentGarbage collectionUnlike C++, and like Java, makes it easy to write codeException HandlingC++ like exception handlingVersioningMultiple version of assemblies with conflictType-safetyNo un-initialized variables

  • .NET PlatformMicrosoft .Net PlatformIn July 2000 (official release V1.0 in 2002), Microsoft .NET Platform was launchedIt is built on top of the operating system. It provides a programming platform for developers to build and deploy windows forms and web applications

    Provides several core technologies and is a combination of the followingThe .NET Framework.NET My ServicesThe .NET Enterprises ServersVisual Studio .NET

  • .NET Platform.NET FrameworkMicrosoft .NET FrameworkThe .NET Framework consists of two main components.NET Framework Class Library (FCL). A rich class library, common to all .NET LanguagesThis provides C# developers access to a complete set of class libraries that are used by other established languages such as Visual Basic.NET and Visual C++.NET.A common execution engineCommon Language Runtime (CLR).Allows an application to use any .NET compliant language through the use of assemblies

    It defines an environment that supports development and execution of distributed, component-based applications

    It defines a "Common Language Specification" (CLS), a standard that ensures seamless interoperability between CLS-compliant languages and class libraries.

    C# or any other language does not contain its class libraries specific to that language

  • .NET Platform.NET FrameworkThe Two main parts of .NET FrameworkFramework Class Library (FCS) or Base Class LibraryReusable code of libraryAll .NET languages use a common class libraryOnce familiar with a library , you can use it in all .NET languageCommon Language Runtime (CLR)Microsofts implementation of the CLI (Common Language Infrastructure, a standard approved by ECMA and ISO)Handles code execution and all of the tasks associated with it (compilation, memory management, security, thread management, type enforcement and type use

  • .NET Platform.NET FrameworkCore C# - Figure 1-1 .NET Framework

  • Objectives of .NET FrameworkProvide a consistent, object-oriented development and runtime environment

    Minimize version conflict DLL Hell and allow multiple versions of the same application to co-exists

    Provide a portable environment, based on certified standards, that can be hosted by an operating system

    Managed Environment in which code can be verified for safe execution

  • Common Language InfrastructureCommon Language InfrastructureA standard that language developers must adhere toCLI defines a platform independent virtual code execution environment that DOES NOT specifies an operating system. So the environment could be Linux or WindowsMicrosofts implementation of CLI is CLR, the Common Language Runtime. CLR meets CLI requirements plus contains many more featuresMany vendors have implemented languages that meets the CLI standard and are part of .NET

  • CLI Standard EnvironmentCore C# Figure 1-2 Architecture defined by CLI specifications

  • .NET FrameworkCLRCommon Language RuntimeCommon language runtime environment is also referred to as managed environment, in which common services such as garbage collection and security are automatically providedSimplifies application developmentProvides a secure and robust execution environmentSupport multiple languagesSimplifies application deployment and management

  • .NET FrameworkFCL.NET Framework Class LibraryA library of classes, interfaces, and value types that are included in the Microsoft .NET Framework SDKProvides access to system functionality and is designed to be the foundation on which .NET Framework applications, components, and controls are builtExposes features of the runtime and provides other services needed by developersAvailable to all .NET LanguagesThe classes simplify development of .NET based applicationsDevelopers can extend them by creating their own libraries of classes

  • Common Language RuntimeCommunications between componentsCOM provided a way for components to integrate. However, each component had to provide the plumbing codeWith the .NET Frameworks Common Language Runtime, objects can interact with each other without any plumbing codeNo registration, GUIDs, .IDL files, HRESULTs, IUnknown, AddRef/Release, CoCreateInstance etc.Classes and inheritance is supported across languagesCOM classes can be imported as .NET classes

  • CLR, CTS, CLSThe Common Language RuntimeCLR takes care of code management at program execution and provides various beneficial services such as memory management, thread management, security management, code verification, compilation, and other system services. The managed code that targets CLR benefits from useful features such as cross-language integration, cross-language exception handling, versioning, enhanced security, deployment support, and debugging.

    Common Type SystemDescribes how types are declared, used and managed in the runtime and facilitates cross-language integration, type safety, and high performance code execution.

    The Common Language SpecificationAn agreement among language designers and class library designers to use a common subset of basic language features (rules) that all languages have to follow.

  • .NET Language and other Interoperability.NET Languages share the same class library.NET Programs can be in any .NET LanguageModules written in different languages can call each other and in the case of classes-inherit from each otherDebugging sessions in Visual Studio.NET crosses over language boundariesAllows developers to choose the best language for each part of the application. All parts will work smoothly the other partsAllows you to connect to unmanaged code, including COM libraries, ActiveX controls, and native (Win32) DLLsA Win32 to .NET Framework API Map is availableIntermediate code from all .NET language is same

  • Common Language Runtime Execution Engine IL + MetadataBase Class LibrariesClass Loader Managed native Code Execution CompilerJIT CompilerSource Code VBVC++C#CobolSecurityManaged Environment

  • Compiled .NET CodeCompilers that are compliant with the CLR generate code that is targeted for the runtime as opposed to CPU (Intermediate Language, IL or MSIL)IL code is assembler type code, packaged in a .EXE or .DLL, similar to byte-code from JavaIL code cannot run by itself. It requires JIT to convert it machine specific codeFramework + JIT takes IL code and puts out machine specific codeIL is portable across platformBesides creating IL, compilers also put metadata in in every code module (more on metadata later)

  • What does CLR Manage?Managed CodeCLR executes intermediate code produced by .NET compliant compilers. It verifies code before executing and monitors and traps system exceptionsManaged DataCLR also allocates/de-allocates data on behalf of the developer. It automatically manages the heap and data segments

  • Un-Managed EnvironmentThe application runs by itself. If memory is not properly managed by the developer, application can hang or crashCompiler (Compile & Link)Source Code Source Code is typically one language, like VB or C++Platform or Operating SystemApplication

  • CLR Common Language Runtime

  • Common Language RuntimeExecution ModelCLRVBSource codeC++C#AssemblyAssemblyAssemblyOperating System ServicesMSILCommon Language Runtime JIT CompilerNativecodeManagedCodeManagedCodeManagedCodeUnmanagedCodeCLR ServicesCompilerCompilerCompiler

  • Common Language RuntimeAssemblies (.NET Binaries)AssemblyAll managed code that runs in .NET must be contained in an assemblyLogical unit of deployment. An .EXE or .DLL fileAn assembly contains ManifestMetadataMSIL resourcesSolution to the DLL Hell problemDLL registration and existence of multiple version of DLLs

  • AssemblyFigure 1-6 Multi-file assembly Core C#

  • .NET Framework Tools.NET Framework Tools.NET Framework SDK tools are designed to make it easier for you to create, deploy, and manage applications and components that target the .NET Framework. You can run most of the tools from the command lineConfiguration and Deployment ToolsDebugging ToolsSecurity ToolsGeneral ToolsDetails can be found at (or search msdn for .NET Framework tools)http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpconNETFrameworkTools.asp

  • Application TypeConsole applicationsCharacter based application. Usually no mouse support and no graphics, just characters Primarily used for teaching programming languagesCommon at one time. Almost died, but now, with .NET, many utility programs are console basedUses Command promptWeb ApplicationWindows applicationsWindows or Forms Contain Graphical User Interfaces (GUIs)Like most current non-web applicationsAssemblies Programs that are used by other applications. Example .dll. Can also be .exe

  • Visual Studio 2008 (Express Edition)An Integrated Development Environment (IDE)Supports a many .NET languages and number will growC#, VB, C++, J#, PerlEditorDebugger Can cross multiple languagesBuild environment - Compiler and LinkerRAD Tool, to quickly build sophisticated GUI applications

  • Visual Studio .NET 2005

  • Creating a Simple ApplicationSelect File New Project Console ApplicationFrom a link, select New Project. Then select Console Application as shown below. Enter a name for your application.

  • Saving Your Application

  • Save the Solution

  • Simple Console ApplicationA Simple Console Application//Author: Saleem Yusuf - A comment, ignored by compiler using System;namespace myFirstApp{ class Program { public static void Main(string[] args) { Console.WriteLine("My First App"); } }}

  • Details of the Simple Console Application

    Using StatementTells the compiler to search the system namespace when resolving reference. This eliminates the need for specifying fully qualified names.System namespace contains all simple data types and is searched even if you do not include a using System; directive

    Namespace.NET class libraries are organized into namespacesIt is a name and a location given to types or your own codeIt provides information to the compiler where to look for referencesThis also makes it possible to distinguish types with same name in different namespace

    // Author: S Yusuf - A comment, ignored by compilerusing System;namespace myFirstApp

  • Details of the Simple Console Application

    class myFirstAppmyFirstApp is the Name of the class you created

    public static void Main(string[] args)Function Main is the starting point of the program.Keyword public is not needed. If there is no access specifier, default is publicclass myFirstApp{ public static void Main(string[] args) {Console.WriteLine("My First App"); }}

  • Details of the Simple Console ApplicationFunction MainMust be publicSo that CLR can access it Must be staticThis is the starting point, so it should not have to instantiated before it can be usedDoes not have to be void, can be anything. Typically an int or voidIt can return a status to the program that called it

    Namespace.NET class libraries are organized into namespacesIt is a name and a location given to types or your own codeIt provides information to the compiler where to look for referencesThis also makes it possible to distinguish types with same name in different namespace

  • Styles of Comments Supported in C#CommentsC++ stylePreferred style. First introduced in C++, also used in Java

    C style

    XML document style - /// single line or /** text */ multi-line/// /// C# compiler can convert these comments into an XML file/// Supported by Visual Studio .NET./// /* Old C type comment style can span across multiple lines. Not recommended and is prone to errors. */// this line is a comment.

  • Styles of Comments Supported in C#XML commentsBegins with three slashes and usually contains XML tags that document a particular aspect of the codeC# compiler recognizes 9 primary tags that are associated with a particular program elementXML comments are exported to a XML file which can be processed for further useBy default, the compiler will not generate the XML file. You must explicitly tell the compiler to do this. Command line example:

    c:\> csc myapp.cs /doc:myappAPI.xml

  • XML Tags (Advanced Topic)

  • C# ApplicationC# ApplicationIs a collections of one of more classesA Class contains fields, properties and methods. It can also have nested classes and reference to other typesC# application can consist of many files and many classes. However, a class cannot span across multiple files (like in C++), unless you have partial classesAll applications have a starting point. Function Main is the starting point for a Console applicationYou can put a Main in every class. If you do, then you must specify which main function is the starting point of your application. Typically done for testingUnlike Java, the file name does not have to be name of the (main) class

  • Reading and Writing to ConsolePrompt user to enter a number and then display it back to the consoleRead from console (string), then covert it to an intDisplay it back to the screen using Console.Writeline

    static void Main(string[] args){ int num; // declare variable to store data

    Console.Write("Please enter a text message: "); string input = Console.ReadLine(); Console.WriteLine("You entered: {0}", input); Console.Write("Please enter a number: "); // read string, then convert string to Int32 num = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("You entered: {0}", num);}

  • Writing to ConsoleWriting To ConsoleBoth methods, Write and WriteLine are overloaded. They can take a number or string as argument.

    Console.WriteLine (99); // Output a numberConsole.WriteLine (Ninety Nine); // Output Text

    Console.WriteLine (Enter a number); // has CR-LFConsole.Write (Enter a number); // No CR-LF

  • Reading and Converting a String to an IntegerConsole.ReadLine()Reads line of text (string) from the ConsoleConsole.Read()Reads the next character from the Console

    Convert.ToInt32(string) takes a string and converts to an integer (Int32)Some other common methods of Convert class. There are many conversion that can be performed (to and from)

  • IdentifiersIdentifiersA name given by the programmer to variables, functions, classes, interfaces (any user defined item)Can contain a sequence of characters, digits, or underscoresCannot start with a digitCase sensitivedecimal x = 50000.00M;int sum = 0;string s = "Saleem";_DispArgs (s);

    Identifiers are x, sum, s, _DispArgs

  • Primitive or Built in Types

  • Types with Examples, Suffix

  • Types with Examples, Suffix

  • Primitive Data TypeAll types, user defied or primitive are derived from systems object typeTables in the preceding slides showed primitive types and their associated System type Primitive types map directly to system types (base class library types) and can be used interchangeably

    Shorter version (int) is an alias provided by C# for System.Int32. Like System.Int32 the underlying type for int is also a struct (will discuss shortly)

    System.Int32 age = new System.Int32(10);int age = 10;System.Int32 age = 17; // a shortcutint iMax = int.MaxValue; // returns largest intint pVal = int.Parse("100"); // converts str to int

  • Numeric Formatting

  • Examples of Numeric Formattingdecimal x = 50000.00M;double y = 500.00;Console.WriteLine("Currency: {0:C}, {1:c4}",x, y);Currency: $50,000.00, $500.0000

    Console.WriteLine("Integer: {0:D6}, {1:D}, {2}",25,35,45);Integer: 000025, 35, 45

    Console.WriteLine("Scientific: {0:E},{1:e2}", y, y);Scientific: 5.000000E+002,5.00e+002

    Console.WriteLine("General: {0:G},{1:g2}, {2:G6}", y, y, y);General: 500,5e+02, 500

    Console.WriteLine("Number: {0:N}, {1:n2}, {2:n6}", x, x, x);Number: 50,000.00, 50,000.00, 50,000.000000

    Console.WriteLine("Hex: {0:X4}, {1:X8}", 255, 255);Hex: 00FF, 000000FF

  • Examples of Numeric Formatting

  • Text FormattingWriting To ConsoleYou can take a format string and additional parametersSyntax is {N,M:FormatString}N = Parameter numberM = Field width and JustificationUse \ as a escape characterConsole.WriteLine (You entered {0}, num1); //Formatting Console.WriteLine (Sum: {0} + {1} = {2}, x, y, (x+y));

    string s = "abc";Console.WriteLine("\"L Justified: {0, -10}\",{1}", 123, s);Console.WriteLine("\"R Justified: {0, 10}\", {1}", 123, s);Output, 123 is left and then right justified. Takes 10 chars"L Justified: 123 ", abc"R Justified: 123", abc

  • Text FormattingWriting To ConsoleUse @ char to display the entire string verbatimTypically used for write path of a folder or file

    Console.WriteLine(@\\ServerName\Share);

  • Implicit and Explicit ConversionsUp-casting, Implicit ConversionOccurs automatically since there will be no data lossFrom a smaller type to bigger type. No loss of precession

    Down-casting, Explicit ConversionRequires a cast. From bigger type to smaller type. Can result in loss of precession

    int n = 10;long m = n; //assigning int to long OKdouble x = n; //assigning long to Double OKdouble x = 3.333; float y = (float) x; //double may not fit in float int i = (int) x; //double may not fit in int

  • Example Similar to Lab 1AWrite a simple console programDeclare a variable of type int, float, double, char and bool.Initialize the variable (after declaring or when it is declared)Print all the variablesPrompt the user to enter values for each type of the variable (one at a time or all at one time).Read the values, overwriting the original values in the variableDisplay all the values

  • static void Main(string[] args){ int i; double x; char ch = 'a'; i = 200; x = 55.978; System.Console.WriteLine("Integer {0}", i); System.Console.WriteLine("Double {0} and ch {1}", x, ch); //Prompt user to enter input, read int, double and char System.Console.Write("\n\n\n"); System.Console.Write("Enter an integer : "); i = Convert.ToInt32(System.Console.ReadLine()); System.Console.Write("Enter a double : "); x = Convert.ToDouble(System.Console.ReadLine()); System.Console.Write("Enter a character : "); ch = Convert.ToChar(System.Console.ReadLine()); System.Console.WriteLine("Integer {0}", i); System.Console.WriteLine("Double {0} and ch {1}", x, ch);}

  • stringsA string of Unicode characters. It is an alias for String in the .NET Framework. Strings are immutable -- the contents of a string object cannot be changed after the object is createdAlthough string is a reference type, the equality operators (== and !=) are defined to compare the values of string objects, not references. This makes testing for string equality more intuitive. For example:string a = "hello";string b = "h";//old b is destroyed and a new string b is createdb += "ello"; Console.WriteLine(a == b);//TrueConsole.WriteLine((object)a == (object)b); //False

  • CharChar structure to represent Unicode charactersA String object is a sequential collection of Char structures that represents a string of text

    public static void Main(){ char chA = 'A'; char ch1 = '1'; string str = "test string"; Console.WriteLine(chA.CompareTo('B')); // Output: "-1" (meaning 'A' is 1 less than 'B') Console.WriteLine(chA.Equals('A')); // Output: "True" Console.WriteLine(Char.GetNumericValue(ch1));// Output:"1" Console.WriteLine(Char.IsControl('\t'));// Output: "True" Console.WriteLine(Char.IsDigit(ch1)); // Output: "True" Console.WriteLine(Char.IsLetter(',')); // Output: "False"

  • Char Console.WriteLine(Char.IsLetter(',')); // Output: "False" Console.WriteLine(Char.IsLower('u')); // Output: "True" Console.WriteLine(Char.IsNumber(ch1)); // Output: "True" Console.WriteLine(Char.IsPunctuation('.'));//Output: "True" Console.WriteLine(Char.IsSeparator(str, 4));// Output:"True" Console.WriteLine(Char.IsSymbol('+')); // Output: "True" Console.WriteLine(Char.IsWhiteSpace(str, 4));//Output:"True" Console.WriteLine(Char.Parse("S")); // Output: "S" Console.WriteLine(Char.ToLower('M')); // Output: "m" Console.WriteLine('x'.ToString()); // Output: "x"}

  • Arithmetic (Binary) OperatorsBinary OperatorsStatements of the formvariable = variable operator expression; can also be rewritten asvariable operator= expression;

    c = c + 3; This can be abbreviated as follows:c += 3;This is called a shortcut and is more efficientOther arithmetic operators and shortcutsd -= 4; (d = d 4;)e *= 5; (e = e * 5;)f /= 3; (f = f / 3;)g %= 9; (g = g % 9;) Assignment Operator

  • Example Lab1B Arithmetic operatorsclass Program{ const double PI = 3.14159; static void Main(string[] args) { int radius; double area, circumference;

    Console.Write("Enter radius of the circle : ");radius = Convert.ToInt32(Console.ReadLine());area = PI * radius * radius;circumference = 2 * PI * radius;Console.WriteLine("Area = {0},Circumference = {1}", area, circumference); }}

    In September 2000, an ECMA task group was established to define a standard that was proposed by Microsoft. The result was standard known as ECMA-334, a standard for language called C#. C# resembles Java and takes a lot from C++. GUI Programming environment resembles Visual Basic

    C# is component-oriented, but first, what is a component? The definition of a component is still contentious. However, there is agreement that components address issues of reuse and deployment, as opposed to objects, which are language-specific concepts.In this module, you will be introduced to the .NET platform. You will then learn about the .NET framework and the language support that the .NET framework provides for the platform. It provides all the all the tools you need to build Windows forms and Web Applications. It consist of several core technologies, as shown above on the slide.

    1) If you programmed in Java and MS environment, there was a big difference. Then if you need to use Perl or some other language, it would make the development task very difficult. Having a development environment that is consistent, doesnt matter which language you use is a big plus. .NET provides this.2) Different applications worked with different version of DLLs and many applications shared DLLs. The last application that was installed could remove or registered a DLL which may not be compatible with other applications. This usually resulted in error messages, or worse, an application would crash..NET allows may version of .DLLs to co-exists. They are not registered any more. Each assembly has a manifest that list the files and version of the file they will use. This solves this major problem. The current DLL was registered and all applications would end-up using it. 3) All programs that run in .NET environment must adhere to standard.The .NET Framework class library is a library of classes, interfaces, and value types that are included in the Microsoft .NET Framework SDK. This library provides access to system functionality and is designed to be the foundation on which .NET Framework applications, components, and controls are built.http://msdn2.microsoft.com/en-us/library/ms229335.aspx

    Compilers that are compliant with the CLR generate code that is targeted for the runtime as opposed to CPU. This code is known as CIL (Common Intermediate Language), IL, or MSIL, is an assembler type language, that is packaged in .EXE or .DLL. It is not a standard .exe and requires JIT to convert it (the IL) to machine specific code. (IL is converted to machine specific code by JIT).Framework + JIT puts out machine specific code. IL is portable across platformCompilers that are compliant with the CLR generate code that is targeted for the runtime as opposed to CPU. This code is known as CIL (Common Intermediate Language), IL, or MSIL, is an assembler type language, that is packaged in .EXE or .DLL. It is not a standard .exe and requires JIT to convert it the IL in it to machine specific code. (IL is converted to machine specific code by JIT).Framework + JIT puts out machine specific code. IL is portable across platform

    Manifest: Each assembly must have one file that contains a manifest. The manifest is a set of tables containing meta-data that lists the names of all files in the assembly, references to external assemblies, and information such as name and version that identifies the assembly. Strongly named assemblies discussed later also include a unique digital signiture.When an assembly is loaded, the CLRs first order of business is to open the file containing the manifest so it can identify the members of the assembly.Metadata: In addition to the manifest tables just described, the C# compiler produces definition and reference tables. The definition table provides a complete description of the types contained in the IL.For instance, there are tables defining types, methods, fields, parameters, and properties.The reference tables contain information on all references to types and other assemblies.The JIT compiler relies on these tables to convert the IL to native machine code.IL: The role of the Intermediate Language has already been discussed.Before the CLR can use IL, it must be packed in an .exe or .dll assembly. The two are not identical; an exe assembly must have an entry point that makes it executable; a dll, on the other had, is designed to function as a coded library holding type definition.

    However, C# has given new life to windows console. There are a lot of new command line commands available to build applications etc.There can be many classes in a Console application and each class can have a main function. In this case, you will have to specify which main is the starting point of your application. This is done through project settingsUnlike Java, in C#, the name of the application does not have to be same as the name of the class