Lab 1
Lab 1
107-091
Welcome
John Morack
• Office L122
• Office Hours
– Wednesdays TBA
• Phone 691-5533
• Email [email protected]
Course Resources
• Required Text
– Programming C# 3.0 (5th Edition)
• Jesse Liberty & Donald Xie
• O’Reilly Publisher
- Software ( after week one) FREE!
- Email
- Student Network Space
- Local Data (C:)
Syllabus
Course requirements
Labs Graded
Backup disk
flash drive
Course Goals
Terminology
• Source - Source Code Source File MyProg.cs
• Module - Compiled code into MSIL or IL
(Intermediate Language)
A single file program MyProg.exe
An Assembly with one file.
Building a program with notepad.
Use notepad and type in a program. (the source)
Save it with the extension .cs
From the command line compile the program using the
compiler csc.
C:\>csc myprog.cs
this produces the file myprog.exe
To run the program just type its name.
C:\>myprog.exe
//***************************************
// My first c# program
//**************************************
using System
public class First
{
static void Main()
{
System.Console.Writeline(“Hello World”);
}
}
Where does the execution begin?
All programs in .net must have a procedure or
subroutine named Main. Main is the entry point for
execution of the program.
Modules and Assemblies
• When you are building programs that use one or
more than one file you create something called an
assembly.
• Compiled source files are called modules.
• Modules can have extensions of .exe or .dll or
.netmodule ( all of these files will contain
compiled code)
• For a module to be able to execute it must be part
of an assembly. ( a compiled file with the
extension .exe is in an assembly by default)
Assembly Manifest
• The .exe file is the lead file of an assembly
and it contains the entry point.
• There can be only one .exe file in an
assembly
• The .exe file contains a list of files called
the manifest. If a file name is not in the
manifest, it cannot be used in the program.
What happens when you run a
program?
• The CLR (common language runtime) loads
the .exe file, translates it into machine
language in memory and transfers control to
the “Main function” in your program.