C# ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT WPF
C# OOPS HTML&CSS DHTML ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT MVVM WPF SQL SERVER Photoshop Dreamweaver Flash Illustrator
Blog Archive
Properties
Properties
In C#, properties are natural extension of data fields. But C# provides a
built in mechanism called properties. Usually inside a class, we declare a data
field as private and will provide a set of public. In C#, properties are defined
using the property declaration syntax. The general form of declaring a property
is as follows.
<acces_modifier> <return_type> <property_name>
{
get
{
}
set
{
}
}
SET and GET methods to access the data fields, since the data fields are not directly accessible out side the class. We must use the set/get methods to access the data fields.
Example:
using System;
class Myproperty
{
private int x;
public int X
{
get
{
return x;
}
set
{
x = value;
}
}
}
class Myprop
{
public static void Main()
{
Myproperty mc = new Myproperty();
mc.X = 10;
int xVal = mc.X;
Console.WriteLine(xVal);//Displays 10
}
}
|
Properties and Inheritance
The properties of a Base class can be inherited to a Derived class.
using System;
class Base
{
public int X
{
get
{
Console.Write("Base GET");
return 10;
}
set
{
Console.Write("Base SET");
}
}
}
class Derived : Base
{
}
class MyClient
{
public static void Main()
{
Derived d1 = new Derived();
d1.X = 10;
Console.WriteLine(d1.X);//Displays 'Base SET Base GET 10'
}
}
|
Properties & Polymorphism
A Base class property can be polymorphic overridden in a Derived class. But remember that the modifiers like virtual, override etc are using at property level, not at accessor level.
using System;
class Base
{
public virtual int X
{
get
{
Console.Write("Base GET");
return 10;
}
set
{
Console.Write("Base SET");
}
}
}
class Derived : Base
{
public override int X
{
get
{
Console.Write("Derived GET");
return 10;
}
set
{
Console.Write("Derived SET");
}
}
}
class MyClient
{
public static void Main()
{
Base b1 = new Derived();
b1.X = 10;
Console.WriteLine(b1.X);//Displays 'Derived SET Derived GET 10'
}
}
|
Abstract Properties
It is declared as abstract by using the keyword abstract. Remember that an abstract property in a class carries no code at all. The get/set assessors are simply represented with a semicolon. In the derived class we must implement both set and get assessors.
using System;
abstract class Abstract
{
public abstract int X
{
get;
set;
}
}
class Concrete : Abstract
{
public override int X
{
get
{
Console.Write(" GET");
return 10;
}
set
{
Console.Write(" SET");
}
}
}
class MyClient
{
public static void Main()
{
Concrete c1 = new Concrete();
c1.X = 10;
Console.WriteLine(c1.X);//Displays 'SET GET 10'
}
}
|
Inheritance ,Polymorphism
Inheritance
In C#, the specialization relationship is generally implemented by using inheritance. Inheritance is also provides the reusability, or we can say that extracts some features from one class to another class.
class Bird
{
public Bird()
{
Console.WriteLine("Bird constructor");
}
public void Greet()
{
Console.WriteLine("Bird says Hello");
}
public void Talk()
{
Console.WriteLine("Bird talk");
}
public virtual void Sing()
{
Console.WriteLine("Bird song");
}
}
class Peacock : Bird
{
public Peacock()
{
Console.WriteLine("Peacock constructor");
}
public new void Talk()
{
Console.WriteLine("Peacock talk");
}
public override void Sing()
{
Console.WriteLine("Peacock song");
}
}
Bird a1 = new Bird();
a1.Talk();
a1.Sing();
a1.Greet();
Bird a2 = new Peacock();
a2.Talk();
a2.Sing();
a2.Greet();
|
Types of Inheritance:
In
Object Oriented Programming concept there are 3 types of inheritances.
1. Single Inheritance,
2. Multiple Inheritance
3. Multilevel Inheritance
Single Inheritance:
public class A
{
}
public class B:A
{
}
Multiple Inheritance:
public class A
{
}
public class B
{
}
public class C:A,B
{
}
Multilevel Inheritance:
public class A
{
}
public class B:A
{
}
public class C:B
{
}
In the above three types C# don't proved Multiple Inheritance. As there is
conflict of multiple override methods in base classes (say A, B in above
example) As in Place C# give another feature called Interfaces using interfaces
you can achieve multiple Inheritance feature.
Polymorphism
Poly means many and morph means form. Thus, polymorphism refers to being able to use many forms of a type without regard to the details.
Creating Polymorphic Types:
For creating polymorphism there are two steps-
1. Create a base class with virtual methods.
2. Create derived classes that override the behavior of the base class’s virtual
methods.
To create a method in a base class that supports polymorphism, mark the method as virtual.
Example.
public class BaseClass
{
public virtual void DoWork()
{
}
public virtual int WorkProperty
{
get {
return 0;
}
}
}
public class DerivedClass : BaseClass
{
public override void DoWork()
{
}
public override int WorkProperty()
{
get {
return 0;
}
}
}
|
Array,Indexer and Collections
Array
An array is the collection of similar type of
objects. Array in C# is different for the array of C++ and other languages
because they are
objects. This provides them useful methods and property. Arrays allow a group of
elements of a particular type to be stored
in a contiguous block of memory. Array types derive from System.Array and are
declared in C# using brackets ([]).
Syntax- datatype [] array-name;
e.g.- int [] age;
The square brackets ([]) tell the C# compiler that you are
declaring an array, and the type specifies the type of the elements it will
contain. In the previous example, age is an array of integers. Instantiate an
array using the new keyword. For example:
age = new int[5]; This declaration sets aside memory for an array holding five
integers.
Multidimensional Array:
Multidimensional Arrays of two types Rectangular Array and Jagged Array
Rectangular Array represents n-dimensional blocks.
e.g.- int [ , ,] age = new
int[17,20,34];
Jagged Arrays are arrays of arrays.
int [][][] books = new int [3][][];
for (int i = 0; i < 3; i++)
{
books[i] = new int [4][];
for (int j = 0; j < 4; j++)
books[i][j] = new int [5];
}
// assign an element
books1 [1,1,1] = books [1][1][1] = 7;
|
Indexer: Indexers are usually known as
smart array in C#.It is used for treating object as an array.Defining an
indexer in C# is much like same as
defining properties. Or we can say that an indexer is a
member that enables an object to be indexed in the same way as an array.
Syntax-
<access modifier> <return type> this [argument list]
{
get
{
// Write here some code for Get
}
set
{
// Write here some code for Get
}
}
Collections:
Collections are the enumerable data
structure in C# that can be assessed using indexes or keys. Types of collections
in C# are given below-
System.Collections namespace
This provides a lot of classes, methods and properties to interact with
the varying data structures that are supported by it. The interfaces
that are defined in this namespace include:
- IEnumerable
- IEnumerator
- ICollection
- IList
- IDictionary
System.Collections.Stack
System.Collections.Queue Both are derived from ICollection Interface.
The collections that inherit the IDictionary interface include:
System.Collections.SortedList System.Collections.Hashtable
The IList interface represents collections that only have value. The following are the classes that extend this interface.
System.Array - System.Collections.ArrayList
- System.Collections.Specialized.StringCollection
Concrete Collection Classes:
ArrayList class- This works by
maintaining an internal array of objects that is replaced with a larger array
when it reaches its capacity of elements.
BitArray class- It is a dynamically
sized array of Boolean values. It is more memory-efficient than a simple
array of bools because it uses only one bit for each value.
Hashtable class- A Hashtable is a
standard dictionary (key/value) data structure that uses a hashing
algorithm to store and index values efficiently.
Queue class- A Queue is a standard
first-in, first-out (FIFO) data structure, providing simple operations to
enqueue, dequeue, peek, etc.
SortedList class-A SortedList is a
standard dictionary data structure that uses a binary-chop search to index
efficiently.
Stack class- A Stack is a standard
last-in first-out (LIFO) data structure.
StringCollection class- A
StringCollection is a standard collection data structure for storing strings.
Control Statements
The if Statement
if statement is used to take different paths of logic, depending on the conditions.
|
The switch Statement
Another form of selection statement is the switch statement, which executes a
set of logic depending on the value of a given parameter. The types of the
values a switch statement operates on can be booleans, enums, integral types,
and strings.
using System;
class SwitchTest
{
public static void Main()
{
Console.WriteLine("milk bottel size: 1=Small 2=Medium 3=Large");
Console.Write("Please enter your selection: ");
string s = Console.ReadLine();
int n = int.Parse(s);
int price = 0;
switch(n)
{
case 1:
price += 25;
break;
case 2:
price += 25;
goto case 1;
case 3:
price += 50;
goto case 1;
default:
Console.WriteLine("Invalid selection. Please select 1, 2, or 3.");
break;
}
if (price != 0)
Console.WriteLine("Please insert {0} cents.", price);
Console.WriteLine("Thank you for your business.");
}
}
|
The while Loop
While loop is used to check a condition and then continues to execute a block of code as long as the condition evaluates to a boolean value of true. Syntax:-
while (<boolean expression>)
{
<statements>
}
When the boolean expression evaluates to false, the while loop statements are
skipped and execution begins after the closing brace of that block of code.
using System;
class whiletest
{
static void Main()
{
//
// Continue in while loop until index is equal to ten.
//
int i = 0;
while (i < 10)
{
Console.Write("While statement ");
//
// Write the index to the screen.
//
Console.WriteLine(i);
//
// Iterate the variable.
//
i++;
}
}
}
|
The do Loop
A do loop is similar to the while loop, except that it checks
its condition at the end of the loop. This means that the do loop is guaranteed
to execute at least one time.
using System;
class DoWhileLoopDemo
{
public static void Main()
{
int i = 0; // Initialize counter variable
do
{
if ((i % 2) == 0)
{
Console.WriteLine(i);
}
i++; //Increment the counter
}
while (i <= Limit); // Condition check
}
}
|
The for Loop
It works like a while loop, except that the syntax of the for loop includes initialization and condition modification. for loops are appropriate when you know exactly how many times you want to perform the statements within the loop. The contents within the for loop parentheses hold three sections separated by semicolons (<initializer list>; <boolean expression>; <iterator list>) { <statements> }.
using System;
class ForLoop
{
public static void Main()
{
for (int i=0; i < 20; i++)
{
if (i == 10)
break;
if (i % 2 == 0)
continue;
Console.Write("{0} ", i);
}
Console.WriteLine();
}
}
|
Foreach Statement:
The foreach statement is
new to the C family of languages; it is used for looping through the elements of
an array or a collection.
class ForEachTest
{
static void Main(string[] args)
{
int[] num = new int[] { 0, 1, 2, 3, 4, 5, 6,7,8 };
foreach (int i in num)
{
System.Console.WriteLine(i);
}
}
}
|
Operators, types and variables in C#
Operators, types and variables in C#
Variables: A variable is a storage location with a type. Variables can have values assigned to them, and those values can be changed programmatically. A constant is a variable whose value cannot be changed.
Types: Like C++ and Java, C# divides types into two sets: intrinsic Built-in types that the language offers and user-defined types that the programmer defines. C# also divides the set of types into two other categories: value types and reference types. The principal difference between value and reference types is the manner in which their values are stored in memory. C# is a "Strongly Typed" language. Thus all operations on variables are performed with consideration of what the variable's "Type" is. There are rules that define what operations are legal in order to maintain the integrity of the data you put in a variable.
The Boolean Type: Boolean types are declared using the keyword, bool. They have two values: true or false. In other languages, such as C and C++, boolean conditions can be satisfied where 0 means false and anything else means true. However, in C# the only values that satisfy a boolean condition is true and false, which are official keywords.
using System;
class Booleans
{
public static void Main()
{
bool content = true;
bool noContent = false;
Console.WriteLine("{0} C# programming language content.", content);
Console.WriteLine("This is second statement {0}.", noContent);
}
}
|
Integral Types: In C#, an integral is a category of types. For anyone confused because the word Integral sounds like a mathematical term, from the perspective of C# programming, these are actually defined as Integral types in the C# programming language specification. They are whole numbers, either signed or unsigned, and the char type. The char type is a Unicode character, as defined by the Unicode Standard.
Floating Point and Decimal Types: A C# floating point type is either a float or double. They are used any time you need to represent a real number. Decimal types should be used when representing financial or money values.
The string Type: A string is a sequence of text characters. You typically create a string with a string literal, enclosed in quotes: "This is an example of a string." You've seen strings being used in Lesson 1, where we used the Console.WriteLine method to send output to the console.
The Array Type: Another data type is the Array, which can be thought of as a container that has a list of storage locations for a specified type. When declaring an Array, specify the type, name, dimensions, and size.
using System;
class NewArray
{
public static void Main()
{
int[] myInts = { 5, 10, 15 };
bool[][] myBools = new bool[2][];
myBools[0] = new bool[2];
myBools[1] = new bool[1];
double[,] myDoubles = new double[2, 2];
string[] myStrings = new string[3];
Console.WriteLine("myInts[0]: {0},
myInts[1]: {1}, myInts[2]: {2}", myInts[0], myInts[1], myInts[2]);
myBools[0][0] = true;
myBools[0][1] = false;
myBools[1][0] = true;
Console.WriteLine("myBools[0][0]:
{0}, myBools[1][0]: {1}", myBools[0][0], myBools[1][0]);
myDoubles[0, 0] = 4.245;
myDoubles[0, 1] = 6.355;
myDoubles[1, 1] = 8.415;
myDoubles[1, 0] = 56.1148917;
Console.WriteLine("myDoubles[0, 0]:
{0}, myDoubles[1, 0]: {1}", myDoubles[0, 0], myDoubles[1, 0]);
myStrings[0] = "An";
myStrings[1] = "App";
myStrings[2] = "Cattt";
Console.WriteLine("myStrings[0]:
{0}, myStrings[1]: {1}, myStrings[2]: {2}", myStrings[0],
myStrings[1], myStrings[2]);
}
}
|
Fundamental of C#
Namespace in C#
Namespaces group related classes and types, and they define categories in which we can include any new class that provides related functionality.
namespace MyCompany.r4r
{
class MyClass
{
// some code here
}
}
namespace MyCompany.r4r
{
class MyClass1
{
// some code here
}
}
|
Classes and Object in C#
Defining Classes: To define a new type or class, first declare it, and then define
its methods and fields. Declare a class using the
class keyword. The
complete syntax is as follows: [attributes] [access-modifiers] class
identifier [:base-class]
{
class-body
}
For Example.
public class Test
{
public static int Main( )
{
Console.Writeline("This is Class");
}
}
|
Defining Object: A distinction is drawn between
value types and reference types. The primitive C# types (int, char, etc.) are
value types, and are created on
the stack. Objects, however, are reference types, and are created on the heap,
using the keyword new, as in the
following:
Test t = new Test(); |
t does not actually contain the value for the test class object; it contains the address of that (unnamed) object that is created on the heap. t itself is just a reference to that object.
How to create a program in C#?
Step 1: Start notepad from Start -> Program Files -> Accessories -> Notepad so that you can write the HelloWorld program. The program you write in C# is also called as source code.
Step 2: Write the HelloWorld program, you can either type the program shown below into notepad or just copy-paste it from here-
public class Helloworld
{
public static void Main()
{
System.Console.WriteLine("you are welcome in world
|
Step 3: Once you have finished typing
your program you should Save the source code file. In fact after making any
changes to your source code, you should always save the file. To save the
file for the first time in notepad click on File menu -> Save As. In the Save As
dialog select the directory from the Save In dropdown where you want to save
your files, I generally save my files to C:\csharp, and then in the File name
textbox, enter the file name as HelloWorld.cs (although you can provide any name
you want but it should have an extension.cs). and click Save. Once you have
saved the
source code, and if you make any further modifications, in notepad use the
Ctrl+S keyboard short-cut to save your source code file.
Step 4: Since you have finished
writing the source code its time to compile it. Since we are using a
command-line compiler that ships with the .NET SDK, start the command prompt
from Start -> Program Files -> Accessories -> Command Prompt. Or go to Start ->
Run, type cmd and press enter. Now from the command prompt navigate to the
directory where you have stored the source code file by issuing the following
DOS commands.cd\ -To navigate to the root of the derived csharp - To navigate to
the csharp directory. Once you are in the csharp directory where you
saved the source code file earlier, its time to run the C# Compiler csc.exe.
Issue the following command to compile our HelloWorld.cs
program:csc HelloWorld.cs
Step 5: If the compilation of the source code was successful then a new executable (Exe) file by the name HelloWorld.exe will be created in the directory you compiled the source code. To execute the program simply type the name of the executable file at the command prompt.
Points to Remember
- C# code can be written in any text editor like notepad.
- C# Source Code files are saved with the extension.cs.
- C# is a case-sensitive language so you have to be careful while typing.
- C# runs on the .NET Platform, hence you need to install the .NET SDK in order to compile C# programs.
- The C# compiler is contained within the file csc.exe, which generally resides in the C:\windows\Microsoft. NET\Framework\v1.0.4322 directory.
C# & other Programming Languages
-
C# is directly related to C and C++, C++ is a superset of C. C and C++ shares several syntax, library and functionality. In addition structures, unions, arrays, strings and pointers are most important and similar functionality for both languages.
-
C# inherits most of its operators, keywords, and statements directly from C++. Enums are clearly a meaningful concept in C++.
Finally I can clearly say that C# is the first component-oriented language in the C/C++ family. -
C# constructors are verisimilar with C++ constructors. Like C++, methods are non-virtual by default, but can be marked as virtual.
- C# allows 'unsafe' code, or pointer manipulation. VB allows methods with optional parameters.
- C# allows assignments embedded in expressions (e.g., if ((x = y.Value) == 2)).VB allows types within interfaces.
- C# has anonymous methods.VB has the very flexible Select construct (much more flexible than the C# switch).
- C# has the useful conditional ternary operator (?:). The VB If function is not a good substitute since the arguments must all be evaluated. VB has the When filter for catch block headers (no equivalent exists in C#).
- C# provides integration with COM.
- C# has "Explicit Member Implementation" which allows a class to specifically implement methods of an interface, separate from its own class methods.
- C# has the ability to alias namespaces.
- C# has support for output parameters, aiding in the return of multiple values, a feature shared by C++ and SQL.
- C# implements properties as part of the language syntax.
- C# allows switch statements to operate on strings.
C# DataTypes
C# DataTypes
Data Types means what type of data a variable can hold . C# is a strongly typed language, therefore every variable and object must have a declared type. The C# type system contains three Type categories.
- Value Types
- Reference Types
- Pointer Types
In C# it is possible to convert a value of one type into a value of another type . The operation of Converting a Value Type to a Reference Type is called Boxing and the reverse operation is called Unboxing .
Ex. int month;
int : is the data type
month: is the variable name
int
int can store signed 32 bit integer values in the range of -2,147,483,648 to
+2,147,483,647
C# Runtime type : System.Int32
C# declaration : int month;
C# Initialization : month = 10;
C# default initialization value : 0
decimal
Decimal is of a 128-bit data type.The approximate range and precision for the
decimal type are -1.0 X 10-28 to 7.9 X 1028
C# Runtime type : System.Decimal
C# declaration : decimal val;
C# Initialization : val = 0.12;
C# default initialization value : 0.0M
string
Represents a string of Unicode characters. string variables are stored any
number of alphabetic,numerical, and special characters .
C# Runtime type : System.String
C# declaration : string str;
C# Initialization : str = ".Net Environment";
bool
Bool is used to declare variables to store the Boolean values, true and false.
In C# , there is no conversion between the bool type and other types.
C# Runtime type : System.Boolean
C# declaration : bool flag;
C# Initialization : flag = true;
C# default initialization value : false
The following list shows the list of data types available in C# and their corresponding class/struct in .NET class library.
| C# Data type | Mapped to .NET class/struct |
| sbyte | System.SByte |
| byte | System.Byte |
| char | System.Char |
| float | System.Single |
| decimal | System.Decimal |
| double | System.Double |
| ushort | System.UInt16 |
| short | System.Int16 |
| uint | System.UInt32 |
| int | System.Int32 |
| ulong | System.UInt64 |
| long | System.Int64 |
| bool | System.Boolean |
| string | System.String |
| object | System.Object |
Boxing:
Converting value types to reference types is also known as boxing. As can be
seen in the example below, it is not necessary to tell the
compiler an Int32 is boxed to an object, because it takes care of this itself.
e.g.-
Int32 a = 10;
object count = a ; // Implicit boxing
Console.WriteLine("The Object count = {0}",count); // prints out 10
//However, an Int32 can always be explicitly boxed like this:
Int32 a = 10;
object count = (object) a; // Explicit boxing
Console.WriteLine("The object count = {0}",count); // prints out 10
Unboxing: The following example intends to
show how to unbox a reference type back to a value type. First an Int32 is boxed
to an object, and then it is
unboxed again. Note that unboxing requires explicit cast.
Ex.
Int32 a = 5;
object count = a; // Implicit
Boxing a = (int)count;
// Explicit Unboxing
Type Conversions Conversion is based on type compatibility and data compatibility.
- Implicit Conversion:
Implicit Conversion In implicit conversion the compiler will
make conversion for us without asking.
char -> int -> float is an example of data compatibility.
using System;
class Program
{
static void Main(string[] args)
{
int x =10000;
int y =20000;
long total;
// In this the int values are implicitly converted to long data type;
//you need not to tell compiler to do the conversion, it automatically does.
total = x + y;
Console.WriteLine("Total is : " + total);
Console.ReadLine();
}
}
|
- Explicit Conversion: In explicit conversion we specifically ask the compiler to convert the value into another data type. CLR checks for data compatibility at runtime.
using System;
class Program
{
static void Main(string[] args)
{
int x = 65;
char value;
value = (char)x;
// In this the int values are explicitly converted to char data type;
//you have to tell compiler to do the conversion, it uses casting.
Console.WriteLine("Value is: " + value);
Console.ReadLine();
}
}
|
Microsoft .NET provides three ways of type conversion:
- Parsing
Parsing is used to convert string type data to primitive value type. For this we use parse methods with value types.
using System;
class Program
{
static void Main(string[] args)
{
//using parsing
int number;
float weight;
Console.Write("Enter any number : ");
number = int.Parse(Console.ReadLine());
Console.Write("Enter your weight : ");
weight = float.Parse(Console.ReadLine());
Console.WriteLine("You have entered : " + number);
Console.WriteLine("You weight is : " + weight);
Console.ReadLine();
}
}
|
-
Convert Class
Convert class contains different static methods like ToInt32(), ToInt16(), ToString(), ToDateTime() etc used in type conversion.
using System;
class Program
{
static void Main(string[] args)
{
// example of using convert class
string num = "23";
int number = Convert.ToInt32(num);
int age = 24;
string vote = Convert.ToString(age);
Console.WriteLine("Your number is : " + number);
Console.WriteLine("Your voting age is : " + age);
Console.ReadLine();
}
}
|
-
Explicit Cast Operator ()
It can used with any type having type compatibility and data type compatibility.
using System;
class Program
{
static void Main(string[] args)
{
int num1, num2;
float avg;
num1 = 10;
num2 = 21;
avg = (float)(num1 + num2) / 2;
Console.WriteLine("average is : " + avg);
Console.ReadLine();
}
}
|
.Net Frameworks Architecture
.Net Frameworks Architecture

.Net is not an Operating System. It is a IDE. It provides some functionality for the programmers to build their solution in the most constructive and intellegent way ever. Just to tell you the truth, most of the codes in .Net environment resembles with the JAVA coding as if some people coming from Java would find it as to their native language.
.NET is a Framework that loads into your operating system, which you need not to load in the later versions of windows like Windows 2003 server or Just a new release of Windows Vista. As it is going to be added as a component in the next generation of windows.
Now, What is the .Net all about? Well, Its a framework that supports Common Language Runtime (CLR). As the name suggests, Common Language Runtime will be something that will run a native code for all the programming languages provided within the Architecture.
Another feature of .net is language independence, to tell you
about language Independence, .Net is not at all efficient in that. Just
Microsoft built their own version of languages like C++, J# (for Java), C#, VB
etc that can communicate between each other. After all J#, even if they
resembles with JAVA is not purely Java.. Thus, the word may look to you somewhat
fake. Now what is the most prospective part of .NET? Now, with the growing
Internet, ASP. NET may be the most important part of .NET technology. Well, ASP.
NET has a new technology where the controls reside server side. You don't bother
to use traditional client side controls. In .NET technology as there is a
provision of runtime building of machine codes, a web server can directly
compile and transmit codes to the browser during runtime. This is , I think the
most approved and widely accepted part of .NET.
NEW things of .NET? well, during the last two years , Microsoft is constantly
changing the .NET technology, that may not be good for a settled programmer.
Well, first of all, in .NET 2003 Microsoft changed some features and also adds
some new things. Well, new things are good, but changing the existing in such a
quick succession is not at all good from programmers point of view. Again, in
2005, Microsoft publishes the new release of VISUAL STUDIO.NET 8 . This is a
completely new environment. It have new releases of controls, the IDE is also
different. That's not what we all wanted as a programmer. What do you say?
Now, Microsoft is also increasing its scope.. One of the most important feature that is just now introduced is AJAX. Well, the name is what can be said as Asynchronous Java Script with XML.
.Net Frameworks Architecture
Introduction to C# Blog
|
|
C# is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg. The most recent version is C# 4.0, which was released on April 12, 2010. 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.
Features of C#
Some notable distinguishing features of C# are:
- There are no global variables or functions. All methods and members must be declared within classes. Static members of public classes can substitute for global variables and functions.
- Managed memory cannot be explicitly freed instead, it is automatically garbage collected.
- Garbage collection addresses the problem of memory leaks by freeing the programmer of responsibility for releasing memory which is no longer needed.
- In addition to the try...catch construct to handle exceptions, C# has a try...finally construct to guarantee execution of the code in the finally block.
- Multiple inheritance is not supported by C#, although a class can implement any number of interfaces.
- Memory management
- Thread management
- Exception handling
- Garbage collection
- Security Central to the .NET Framework is its runtime execution environment, known as the Common Language
in different programming languages to easily share information. Functions of the Common Type System:-
- CTS establishes a framework that helps enable cross-language integration, type safety, and high performance code execution.
- CTS provides an object-oriented model that supports the complete implementation of many programming languages.
- CTS also defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.
- Languages supported by .NET can implement all or some common data types.
Value types: Value types directly contain their data, and instances of value types are either allocated on the stack or allocated inline in a structure. Value types can be built-in (implemented by the runtime), user-defined, or enumerations.
Reference types: Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. The type of a reference type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates.









