Thursday, August 19, 2010

Auto Rich Text Box(Sixth Sense Text Box)-Powered By Aravind

Hi Guy's I have a small demo on auto rich text box(auto text and link identifier). Simply i am calling it as sixth sense text box.

Because,In case of rich text box, there is no auto identifier for link and normal text. I am not aware about whether auto rich text box(sixth sense) are available or not. But i have tried to develope a auto rich text box.
So, this will identifies for normal text and link auto matically.

On click of entered links are able to navigate to corresponding site.

I have implemented on silverlight datagrid successfully!!.

Mail @

Monday, August 16, 2010

Genirics in C#--Simple Example

C# 2.0 has introduced concept of generics,Iterators,Anonymous Methods.
Let's consider concept of generics. So What is generics?

Generics is type of data structure.This results in a significant performance boost and higher quality code, because you get to reuse data processing algorithms without duplicating type-specific code.It wont follow any data type rule while compailation. i.e no need to define any data type while defining. You can define generic interfaces, classes, methods, events and delegates.

Example: Consider implementaion of generics to class.

1.generic types to maximize code reuse, type safety, and performance.
2.The most common use of generics is to create collection classes.


Friday, August 6, 2010

Usage of Extensions method in C# -Example

C# 3.0 has provided extension method. let's know first what is extension method in c#?

As name it self defines, extension method is a method which will extend/add the methods to existing types.Extension methods are special kind of static methods within static class.

Let us consider simple class.
///This class contains single method Display.
public class Class1
public void Display()
MessageBox.Show("Hello Aravind");

Let's consider another class(extension class)

//This is the static class in which static extension method defined.
//Here i have used this key word to extend/Add method to class class1.
public static class ExtendMyMethod
public static void Extend(this Class1 ObjClass )
MessageBox.Show("Hello Aravind,You have extended previous method.");

//Accessing/using extension method of class1.

public class UsageOfExtensionMethod
Class1 objCls1=new Class1();//object of class1.
objCls1.Display();//Normal method defined in class1.
objCls1.Extend();//Extension method.(Extension).

An extension method must be defined in a top-level static class.
An extension method with the same name and signature as an instance method will not be called.
Extension methods cannot be used to override existing methods.
The concept of extension methods cannot be applied to fields, properties or events.
Overuse of extension methods is not good style of programming.

Thanks & Regards

Tuesday, August 3, 2010

Dyanamic And Object Keywords in C#

C# 4.0 has provided dynamic keyword to define variables.Object keyword is defined already in c# 1.0.

So, I will define object
object obj = 10;

When you add value to object 'obj' by 10,
// A compiler error, because
// at compile time the type of obj is System.Object.
obj = obj + 10;
It's failed because of datatype conversion.
// You need to explicitly cast obj to a necessary type.
obj = (int)obj + 10;

Let's define dynamic keyword now

dynamic dyn = 10;//dyn as dynamic.

//Adding value to dynamic variable.

dyn = dyn + 10;

// Also, this operation will succeed for all numeric
// or other types that support a “+” operation.
dyn = 10.0;
dyn = dyn + 10;

So, By defining as dynamic,it will automatically determine compatible datatype on runtime.