c# usage,applications and advantages

20

Upload: mohamed-drahem

Post on 07-Jul-2015

150 views

Category:

Engineering


7 download

DESCRIPTION

slides about c# programming language

TRANSCRIPT

Page 1: c# usage,applications and advantages
Page 2: c# usage,applications and advantages

Mohamed Adel Drahem

Page 3: c# usage,applications and advantages

Name & history

Page 4: c# usage,applications and advantages

The sharp symbol also resembles a ligature of four "+" symbols (in a two-by-two grid), further implying that the language is an increment of C++.

Page 5: c# usage,applications and advantages

History of c#

Page 6: c# usage,applications and advantages

During the development of the .NET Framework, the class libraries were originally written using a managed code compiler system called Simple Managed C (SMC). In January 1999, Anders Hejlsberg formed a team to build a new language at the time called Cool, which stood for "C-like Object Oriented Language". Microsoft had considered keeping the name "Cool" as the final name of the language, but chose not to do so for trademark reasons. By the time the .NET project was publicly announced at the July 2000 Professional Developers Conference, the language had been renamed C#, and the class libraries and ASP.NET runtime had been ported to C#.

Page 7: c# usage,applications and advantages

syntax

Page 8: c# usage,applications and advantages

The core syntax of C# language is similar to that of other C-style languages such as C, C++ and Java. In particular:

Page 9: c# usage,applications and advantages

Semicolons are used to denote the end of a statement.

Curly brackets are used to group statements. Statements are commonly grouped into methods (functions), methods into classes, and classes into namespaces.

Variables are assigned using an equals sign, but compared using two consecutive equals signs.

Square brackets are used with arrays, both to declare them and to get a value at a given index in one of them.

Page 10: c# usage,applications and advantages
Page 11: c# usage,applications and advantages

Advantages over java

Page 12: c# usage,applications and advantages

Advantages over java Usually it is much more efficient than java

and runs faster

CIL (Common (.NET) Intermediate Language) is a standard language, while java byte codes aren't

It has more primitive types (value types), including unsigned numeric types

Indexers let you access objects as if they were arrays

Conditional compilation

Page 13: c# usage,applications and advantages

Simplified multithreading

Operator overloading. It can make development a bit trickier but they are optional and sometimes very useful

(limited) use of pointers if you really need them, as when calling unmanaged (native) libraries which doesn't run on top of the virtual machine (CLR)

Page 14: c# usage,applications and advantages

Advantages over C and C++ It is compiled to an intermediate language (CIL)

indepently of the language it was developed or the target architecture and operating system

Automatic garbage collection

Pointers no longer needed (but optional)

Reflection capabilities

Don't need to worry about header files ".h"

Definition of classes and functions can be done in any order

Page 15: c# usage,applications and advantages

Declaration of functions and classes not needed

Unexisting circular dependencies

Classes can be defined within classes

There are no global functions or variables, everything belongs to a class

All the variables are initialized to their default values before being used (this is automatic by default but can be done manually using static constructors)

Page 16: c# usage,applications and advantages

You can't use non-boolean variables (integers, floats...) as conditions. This is much more clean and less error prone

Apps can be executed within a restricted sandbox

Page 17: c# usage,applications and advantages
Page 18: c# usage,applications and advantages

Usage The three main types of application that can be written in C#

Winforms - Windows like Forms.

Console - Command line Input and Output.

Web Sites.

Page 19: c# usage,applications and advantages

Some applications of c# Simple command line utilities. Input stuff. Convert

stuff. Output stuff.

Desktop applications. You can create a decent Forms based (or WPF based) GUI app fairly quickly in C#.

Windows service. GUI-less code that runs as a service that gets stuff as input, converts stuff and outputs stuff.

Page 20: c# usage,applications and advantages

• Data access layer. C# is a good language for providing the 'shim' between application code and the database.

• Web services. Exposing a web service API using C# is straight forward. And web services are a convenient way to communicate between different processes, especially if they are running on different machines/operating systems.