Wednesday 1 January 2014

INTRODUCTION to C# LANGUAGE :

- C# is a modern, general-purpose, object oriented programming language developed by Microsoft & approved by ECMA & ISO.
- C# was Developed by 'Anders Hejlsberg' & his team during the development of .NET Framework.
- C# is  designed for Common Language Infrastructure(CLI), which consists of the executable code & runtime environment that allows use of various high-level languages to be used on different computer platforms & architectures.

"Why C# can be pronounced as "C-sharp" not "c hash""...?

The name "C sharp" was inspired by musical notation where a sharp indicates that the written note should be made a semitone higher in pitch. This is similar to the language name of C++, where "++" indicates that a variable should be incremented by 1.

Due to technical limitations of display (standard fonts, browsers, etc.) and the fact that the sharp symbol (U+266F ♯​ music sharp sign (HTML: ♯)) is not present on the standard keyboard, the number sign (U+0023 #​ number sign (HTML: #)) was chosen to represent the sharp symbol in the written name of the programming language. This convention is reflected in the ECMA-334 C# Language Specification. However, when it is practical to do so (for example, in advertising or in box art), Microsoft uses the intended musical symbol.

The "sharp" suffix has been used by a number of other .NET languages that are variants of existing languages, including J# (a .NET language also designed by Microsoft which is derived from Java 1.1), A# (from Ada), and the functional F#. The original implementation of Eiffel for .NET was called Eiffel#, a name since retired since the full Eiffel language is now supported. The suffix has also been used for libraries, such as Gtk# (a .NET wrapper for GTK+ and other GNOME libraries), Cocoa# (a wrapper for Cocoa) and Qt# (a .NET language binding for the Qt toolkit).

Reasons which make C# a widely used professional language:

 - Modern general-purpose programming language.
- Object Oriented.
- Component Oriented.
- Easy to learn.
- Structured language.
- It can be compiled on variety of computer platforms.
- Part of DOT NET Framework.

Strong Programming features of C# :

- C# closely follow traditional high-level languages C & C++ & being an OOP language, it has strong resemblance with java.
- Automatic Garbage Collections.
- Standard Library.
- Assembely Versioning.
- Properties & Events.
- Delegated & Events Management.
- Easy-to-use Generics.
- Indexers.
- Conditional Compilation.
- Boolean Conditions.
- Simple Multithreading.
- LINQ & Lambda Expressions.
- Integration with windows.

C# Program Structure :

A C# program basically consists of the following parts:

- Namespace Declaration.
- A class.
- Class Methods.
- Class Attributes.
- A main Method.
- Statements & Expressions.
- Comments.


Drawbacks of ASP :

There are many problems with ASP if you think of needs for Today’s powerful Web applications.

  • Interpreted and Loosely-Typed Code

ASP scripting code is usually written in languages such as JScript or VBScript. The script-execution engine that Active Server Pages relies on interprets code line by line, every time the page is called. In addition, although variables are supported, they are all loosely typed as variants and bound to particular types only when the code is run. Both these factors impede performance, and late binding of types makes it harder to catch errors when you are writing code.
  • Mixes layout (HTML) and logic (scripting code)

ASP files frequently combine script code with HTML. This results in ASP scripts that are lengthy, difficult to read, and switch frequently between code and HTML. The interspersion of HTML with ASP code is particularly problematic for larger web applications, where content must be kept separate from business logic. 
  • Limited Development and Debugging Tools

Microsoft Visual InterDev, Macromedia Visual UltraDev, and other tools have attempted to increase the productivity of ASP programmers by providing graphical development environments. However, these tools never achieved the ease of use or the level of acceptance achieved by Microsoft Windows application development tools, such as Visual Basic or Microsoft Access. ASP developers still rely heavily or exclusively on Notepad.
Debugging is an unavoidable part of any software development process, and the debugging tools for ASP have been minimal. Most ASP programmers resort to embedding temporary Response. Write statements in their code to trace the progress of its execution.
  • No real state management

Session state is only maintained if the client browser supports cookies. Session state information can only be held by using the ASP Session object. And you have to implement additional code if you, for example, want to identify a user. 
  
  • Update files only when server is down

If your Web application makes use of components, copying new files to your application should only be done when the Web server is stopped. Otherwise it is like pulling the rug from under your application’s feet, because the components may be in use (and locked) and must be registered.
  •  Obscure Configuration Settings

The configuration information for an ASP web application (such as session state and server timeouts) is stored in the IIS metabase. Because the metabase is stored in a proprietary format, it can only be modified on the server machine with utilities such as the Internet Service Manager. With limited support for programmatically manipulating or extracting these settings, it is often an arduous task to port an ASP application from one server to another.