Csharp Tutorials

1. Major features of C#

By: Ram Baskar : 2011-02-05

Description: By design, C# is the programming language that most directly reflects the underlying Common Language Infrastructure (CLI). Most of its intrinsic types correspond to value-types implemented by the CLI framework. However, the language specification does not state the code generation requirements of the compiler: that is, it does not state that a C# compiler must target a Common Language Runtime, or generate Common Intermediate Language (CIL), or generate any other specific format. Theoretically, a C# compiler could generate machine code like traditional compilers of C++ or Fortran.

2. Categories of datatypes in C#

By: Ram Baskar : 2011-02-05

Description: Value types are plain aggregations of data. Instances of value types do not have referential identity nor a referential comparison semantics - equality and inequality comparisons for value types compare the actual data values within the instances, unless the corresponding operators are overloaded. Value types are derived from System.ValueType, always have a default value, and can always be created and copied. Some other limitations on value types are that they cannot derive from each other (but can implement interfaces) and cannot have an explicit default (parameterless) constructor. Examples of value types are some primitive types, such as int (a signed 32-bit integer), float (a 32-bit IEEE floating-point number), char (a 16-bit Unicode code unit), and System.DateTime (identifies a specific point in time with nanosecond precision). Other examples are enum (enumerations) and struct (user defined structures).

3. Boxing and unboxing in C#

By: Ram Baskar : 2011-02-05

Description: Boxing is the operation of converting a value of a value type into a value of a corresponding reference type. Boxing in C# is implicit.

4. Preprocessor directives in C#

By: Ram Baskar : 2011-02-05

Description: C# features "preprocessor directives" (though it does not have an actual preprocessor) based on the C preprocessor that allow programmers to define symbols but not macros. Conditionals such as #if, #endif, and #else are also provided. Directives such as #region give hints to editors for code folding.

5. Comments in C#

By: Ram Baskar : 2011-02-05

Description: C# utilizes a double forward slash (//) to indicate the rest of the line is a comment. This is inherited from C++.

6. Hello World sample program in C#

By: Ram Baskar : 2011-02-05

Description: The above line of code tells the compiler to use 'System' as a candidate prefix for types used in the source code. In this case, when the compiler sees use of the 'Console' type later in the source code, it tries to find a type named 'Console', first in the current assembly, followed by all referenced assemblies. In this case the compiler fails to find such a type, since the name of the type is actually 'System.Console'. The compiler then attempts to find a type named 'System.Console' by using the 'System' prefix from the using statement, and this time it succeeds. The using statement allows the programmer to state all candidate prefixes to use during compilation instead of always using full type names.

7. SOAP serialization in C#

By: Jason Price : 2011-02-04

Description: This sample C# program illustrates SOAP serialization

8. What is C#?

By: Ram Baskar : 2011-02-04

Description: C# (pronounced "see sharp") is a multi-paradigm programming language encompassing imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft within the .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270). C# is one of the programming languages designed for the Common Language Infrastructure.

9. Design Goals of C#

By: Ram Baskar : 2011-02-04

Description: The ECMA standard lists these design goals for C#:

10. Why it was named C#?

By: Ram Baskar : 2011-02-04

Description: 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.