Posts

Showing posts from January, 2011

C# 4.0 Dynamics vs. Reflection

Image
Hi! Ah ha, today I already wrote two more blog now I am moving on third one, I found new feature in C# 4.0 is Dynamics its to cool. its much faster than reflection mechanism also cached objects, Simply I show demo given below, First I create a Console Application then create a class name is myTestingClass Snippet public class myTestingClass { public string myProperty { get ; set ; } } Now I am going to call the above class by reflection and Dynamics. Snippet static void Main( string [] args) { Stopwatch mystopWatch = new Stopwatch (); long rang = 1000000; var myTestType = new myTestingClass (); var property = typeof ( myTestingClass ).GetProperty( "myProperty" ); mystopWatch.Start(); for ( int i = 0; i { property.SetValue(myTestType, "...