Ch1 Programming Languages
Ch1 Programming Languages
C#
Program
• C# is object-oriented
• In 2001, the European Computer Manufacturers
Association (ECMA) General Assembly ratified
C# and its common language infrastructure (CLI)
specifications into international standards
Console-based
application
output
• Comments
– line 1 // This is traditionally the first program
written.
– Like making a note to yourself or readers of your
program
– Not considered instructions to the computer
– Not checked for rule violations
– Document what the program statements are doing
C# Programming: From Problem Analysis to Program Design 16
Comments
• Syntax
– using namespaceIdentifier;
• Program statements
• WriteLine( ) → member of the Console class
• Main( ) invoking WriteLine( ) method
• Member of Console class
• Method call ends in semicolon
Clicking Yes
causes the class
name to also be
renamed
• Types of errors
– Syntax errors
• Typing error
• Misspelled name
• Forget to end a statement with a semicolon
– Run-time errors
• Failing to fully understand the problem
• More difficult to detect
Pushpin
Errors reported
Delete [STAThread]
Depending on your
Can replace with static void Main( )
current settings, you
may not need to make Replace TODO: with your program
some of these changes statements