Похожие презентации:
C#
1.
C# PresentationTrey Mack
James Moore
Osa Osar-Emokpae
2. Introduction
C#, pronounced “C Sharp,” is one ofthe 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
3. History
CC++
Developed by Anders Hejlsberg
Turbo Pascal
Delphi
Visual J++
Released in 2001-2002
C# Presentation, Spring 2003
4. Previous Problems
Memory LeaksIllegal Pointer References
Overly Complex Multiple-Inheritance
Static Linking
C# Presentation, Spring 2003
5. Resolutions
Garbage CollectionThrew out pointers
Single inheritance with Interfaces
Dynamic Linking
Done 5 years ago in Java
C# Presentation, Spring 2003
6. What is C#
Contrary to popular belief, C# isnot simply a clone of or
replacement for Java
According to Anders Hejlsberg,
Microsoft’s Chief Architect, C# is a
derivation of C++, C, Java, Modula
2, and Smalltalk
C# Presentation, Spring 2003
7. What is C#
C# combines the best features ofthese languages and eradicates
some of their weaknesses
C# Presentation, Spring 2003
8. Why Choose C#?
C# was designed from scratch withthe .net framework in mind
C# combines the power of C and
C++ with the productivity of Visual
Basic
With its familiar syntax the
transition for Java and C++
programmers will be an easy one
C# Presentation, Spring 2003
9. Why Choose C#?
C# is in sync with current webstandards 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
10. Example of Code
The code looks a lot like Javapublic class Example
{
public static void Main(string[] args)
{
foreach (string s in args)
{
System.Console.WriteLine(s);
}
}
}
C# Presentation, Spring 2003
11. Features
OOPC# Presentation, Spring 2003
12. OOP
C# is object oriented. Every class is asubclass 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
13. Features
OOPEnumerators
C# Presentation, Spring 2003
14. Enumerators
Enumerators are a borrowed ideafrom 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
15. Features
OOPEnumerators
Operator Overloading
C# Presentation, Spring 2003
16. Operator Overloading
Operator Overloading is yet anotheridea borrowed from c++. This
makes polymorphism easier with
custom data types.
Example:
Currency a, b, c;
c = a + b;
C# Presentation, Spring 2003
17. Features
OOPEnumerators
Operator Overloading
Windows API Invocation
C# Presentation, Spring 2003
18. 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
19. Features
OOPEnumerators
Operator Overloading
Windows API Invocation
Structured Error Handling
C# Presentation, Spring 2003
20. Structured Error Handling
C# introduces new error handlingtechniques.
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
21. Try-Catch
try-catch blocks could be any of the following;try{ } catch(SomeException){ }
try{ } catch(){ } //catches any kind of exception
try{ } catch(){ } finally{ } //finally is always
executed
try{ } finally{ } //finally is always executed
C# Presentation, Spring 2003
22. Features
OOPEnumerators
Operator Overloading
Windows API Invocation
Structured Error Handling
Delegates
C# Presentation, Spring 2003
23. Delegates
Delegates provide a template for asingle method.
Example:
public delegate int ArithOp(int a, int b);
…
public int DoOp(ArithOp ar)
{ return ar(a, b); }
C# Presentation, Spring 2003
24. Features
OOPEnumerators
Operator Overloading
Windows API Invocation
Structured Error Handling
Delegates
Namespaces
C# Presentation, Spring 2003
25. Namespace
Namespace is a method of organizingsimilar 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:
namespace Project{ public class P1{} }
public class P2{}
C# Presentation, Spring 2003
26. Namespace
To use a namespace, you just simply importby using the keyword using.
Example:
using system;
public class P1{}
C# Presentation, Spring 2003
27. Future of C#
With C#’s flexibility and support formany languages through the .NET
architecture it will definitely become
a widely used language in all
aspects of programming.
C# Presentation, Spring 2003
28. Bibliography
C# programming, Harvey, Robinson, Templeman,Watson
http://www.funducode.com/csharp/basics/basi
cs1.htm
http://www.simonrobinson.com/DotNET/Article
s/Languages/IntroCSh.aspx
http://windows.oreilly.com/news/hejlsberg_08
00.html
http://msdn.microsoft.com/msdnmag/issues/0
900/csharp/default.aspx
C# Presentation, Spring 2003