C# Presentation
By Santosh Tawde
Introduction
C#, pronounced “C Sharp,” is one of the new languages in the .NET framework being implemented by Microsoft. All .NET languages compile to a common byte code (MSIL) making their integration into programs written in different languages easier.
C# Presentation, Spring 2003
History
C# Presentation, Spring 2003
Previous Problems
C# Presentation, Spring 2003
Resolutions
C# Presentation, Spring 2003
What is C#
C# Presentation, Spring 2003
What is C#
C# Presentation, Spring 2003
Why Choose C#?
C# Presentation, Spring 2003
Why Choose C#?
C# is in sync with current web standards and is easily integrated with existing applications.
In today’s society where internet programming is inevitable having a language that already supports this makes the job of the developer easier.
C# Presentation, Spring 2003
Example of Code
The code looks a lot like Java
public class Example
{
public static void Main(string[] args)
{
foreach (string s in args)
{
System.Console.WriteLine(s);
}
}
}
C# Presentation, Spring 2003
Features
C# Presentation, Spring 2003
OOP
C# is object oriented. Every class is a subclass of an object. Everything is an object, yes even primitives. This makes generic programming easier.
Example:
int n = 3;
string s = n.ToString();
C# Presentation, Spring 2003
Features
C# Presentation, Spring 2003
Enumerators
Enumerators are a borrowed idea from C/C++. This is a data type consisting of a set of of named integers.
Example:
enum Weekday {Mon, Tues, Wed, Thu,
Fri, Sat, Sun};
C# Presentation, Spring 2003
Features
C# Presentation, Spring 2003
Operator Overloading
Operator Overloading is yet another idea borrowed from c++. This makes polymorphism easier with custom data types.
Example:
Currency a, b, c;
c = a + b;
C# Presentation, Spring 2003
Features
C# Presentation, Spring 2003
Windows API Invocation
C# was built with Windows in mind. It was created to allow programmers to create Windows application easily through a wraparound API. Some other technologies supported are COM, COM+.
C# Presentation, Spring 2003
Features
C# Presentation, Spring 2003
Structured Error Handling
C# introduces new error handling techniques.
Try-catch blocks are used but with more functionality.
To throw an object, it has to be a subclass of System.Exception.
C# Presentation, Spring 2003
Try-Catch
C# Presentation, Spring 2003
try-catch blocks could be any of the following;
Features
C# Presentation, Spring 2003
Delegates
Delegates provide a template for a single method.
Example:
C# Presentation, Spring 2003
Features
C# Presentation, Spring 2003
Namespace
Namespace is a method of organizing similar files together. This is similar in some way to the java package idea. Every program is either explicitly within a namespace or in by default.
Example:
C# Presentation, Spring 2003
Namespace
C# Presentation, Spring 2003
To use a namespace, you just simply import by using the keyword using.
Example:
using system;
public class P1{}
Future of C#
With C#’s flexibility and support for many languages through the .NET architecture it will definitely become a widely used language in all aspects of programming.
C# Presentation, Spring 2003
Bibliography
C# Presentation, Spring 2003