Module 2 - Overview of C#
Module 2 - Overview of C#
Overview of C#
By
SRIRAM . B
Overview
Introduction to C# Programming
Features of C# Programming
Structure of a C# Program
Basic Input/Output Operations
Recommended Practices
Compiling, Running, and Debugging
ILDASM Demo
Introduction to C# Programming
C-Sharp is the latest programming language introduced
by Microsoft to overcome the shortcomings of C and C+
+.
C# Code
C# Program Execution..
C# application Assembly
Code Compilation
C# Program Execution..
System Runtime
Hello, World
The Class
The Main Method
The using Directive and the
System Namespace
Demonstration: Using Visual
Studio to Create
a C# Program
Hello, World
using
using System;
System;
class
class Hello
Hello
{{
public
public static
static void
void Main()
Main()
{{
Console.WriteLine("Hello,
Console.WriteLine("Hello, World");
World");
}}
}}
The Class
using
using System;
System;
The using directive
……
Console.WriteLine("Hello,
Console.WriteLine("Hello, World");
World");
Basic Input/Output Operations
Commenting Applications
Generating XML Documentation
Exception Handling
Commenting Applications
Multiple-line comments
/*
/* Find
Find the
the higher
higher root
root of
of the
the
quadratic
quadratic equation
equation */
*/
xx == (…);
(…);
Generating XML Documentation
///
/// <summary>
<summary> The
The Hello
Hello class
class prints
prints aa greeting
greeting
///
/// on
on the
the screen
screen
///
/// </summary>
</summary>
class
class Hello
Hello
{{
///
/// <remarks>
<remarks> We
We use
use console-based
console-based I/O.
I/O.
///
/// For
For more
more information
information about
about WriteLine,
WriteLine, see
see
///
/// <seealso
<seealso cref="System.Console.WriteLine"/>
cref="System.Console.WriteLine"/>
///
/// </remarks>
</remarks>
public
public static
static void
void Main(
Main( ))
{{
Console.WriteLine("Hello,
Console.WriteLine("Hello, World");
World");
}}
}}
Exception Handling
using
using System;
System;
public
public class
class Hello
Hello
{{
public
public static
static void
void Main(string[
Main(string[ ]] args)
args)
{{
try{
try{
Console.WriteLine(args[0]);
Console.WriteLine(args[0]);
}}
catch
catch (Exception
(Exception e)
e) {{
Console.WriteLine("Exception
Console.WriteLine("Exception atat
{0}", e.StackTrace);
{0}", e.StackTrace);
}}
}}
}}
Invoking the Compiler