Archive

Archive for September, 2011

Difference between Events and Delegates in C #

September 29th, 2011 No comments

Difference between Events and Delegates in C Sharp

Both are very important in event driven programming, event’s are the reason of happening and delegates are the address of function. Events are like a property and well decorated in IL so that correct method can invoke.

>> Click here to Read the complete Article

Delegates in C#

September 29th, 2011 No comments

Delegates:

Definition: Delegates adds more value to event driven programming. They are very similar to function pointer in C++. Delegates are type safe pointers and they provide callback function in safe way. They are used to declare the reference type. Delegates are used to declare custom events. If you want to change the behaviour of your application in runtime, delegates are the best example, in other words here you can apply delegates. They always work with events. Event driven programming contains two types of object:

>> Click here to Read the complete Article

Tutorial – Indexers in C#

September 26th, 2011 No comments

Applicable: C# 3.5

Definitions: Indexers was introduced in C# 2.0. Indexers are very similar to array, however, they are very close to the way when used in vb (setters and getters) to access the values. They are used to define the property and provide access to a value of an array outside the class. In array you can access any item or element by using index number which is an integer value. In indexer you can access elements with the name of key rather than value. Like array Indexers can be overloaded. Indexer must have one parameter.

Syntax: <Modifier> type this[type parameter]: where

modifier can be private/public /protected/internal

type: Any Valid type In C#(int, string etc)

this: represent the object of the current class

Parameter: formal – argument list, at least one parameter has to be there, to avoid the compiler error.

Example:

>> Click here to Read the complete Article

Categories: Tutorial for Beginners Tags:

Directory Classes Tutorial in C#

September 25th, 2011 No comments

Applicable for C#: 1.0, 1.1, 2.0, 3.0, 3.5, 4.0

Directory classes are very important when user want to save information in a file instead of database. Directory works as a folder which contains multiple files like windows folders. In .Net by using System.IO namespace we can do all operation related with directory manipulation such as creating new directory, deleting the content of existing directory, you can rename existing directory or file and many more. Here are the list of few common properties and methods

>> Click here to Read the complete Article