c# usage,applications and advantages

Post on 07-Jul-2015

150 Views

Category:

Engineering

7 Downloads

Preview:

Click to see full reader

DESCRIPTION

slides about c# programming language

TRANSCRIPT

Mohamed Adel Drahem

Name & history

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++.

History of c#

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#.

syntax

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

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.

Advantages over java

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

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)

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

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)

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

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.

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.

• 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.

top related