Archive for September, 2008
Separator Delimited ToString for Array, List, Dictionary, Generic IEnumerable
Often programmers want to convert an array into one string with for example comma delimited. Traditionally, in C#, it can be achieved by int[] array = {1,2,3}; string delimited = string.Join(”,”, array); Console.WriteLine(delimited ) // output: "1,2,3" However, string.Join does not apply to any generic IEnumerable object. It would be so much easier if […]
C# Pointer in unsafe context
Pointer usage in C# in unsafe context static unsafe void Main() { int i; int[] array = { 11, 22, 33 }; // pointer pi has the address of variable i int* pi = &i; i = 0; // dereference the pi, i.e. […]
Get Current Directory while running as WindowsService
During development, while you run the application as a console application or windows form application, often the code needs to load a specific file within the same folder of the exe assembly resides. The file can be located by using the file name directory since the default location will be the exe’s directory. For instance, […]
Chrome vs IE Javascript Engine Performance Comparison
Operating System: Windows Vista Enterprise 32 bit CPU: Intel Pentium(R) 4 CPU 3.00GHz Memory: 2038 MB Tools: Testing Javascript Page Opera 9.24 Score: 82 It is not too bad. Firefox 3 Score : 109 It is fairly fast! Chrome beta Score : 1105 WOW, ten times faster than firefox, I am glad I downloaded it. […]