One day my colleague asked me if there is a way to know the registered application to a specific extension, or how OS executes Notepad when user double clicks on any txt files. Here is my finding over it.
Filed under: C# | Tagged: C# | 1 Comment »
One day my colleague asked me if there is a way to know the registered application to a specific extension, or how OS executes Notepad when user double clicks on any txt files. Here is my finding over it.
Filed under: C# | Tagged: C# | 1 Comment »
The Idea came while I was writing a wrapper for PE file structure early this year that was even before I ever started writing bog. Loads of Enum has to be provided with their information. The solution was simple, attach a custom attribute to each member of the Enum and later retrieve them using reflection. [...]
Filed under: C# | Tagged: C#, Extension Method, Reflection | Leave a Comment »
I had to write a switch case for an Enum that contains huge amount of members. Writing each case with hitting the keyword is frustrating and time consuming. So I wrote a little code that builds a switch case for every member of Enum in an Assembly. The Logic behind the scene is extremely simple. [...]
Filed under: C# | Tagged: C#, Reflection | 1 Comment »
This code is extracted using Reflector of System.Collection.HashHelper class (internal: not available for user) internal static bool IsPrime(int candidate) { if ((candidate & 1) == 0) { return (candidate == 2); } int num = (int)Math.Sqrt((double)candidate); for (int i = 3; i <= num; i += 2) { if ((candidate % i) == 0) { [...]
Filed under: Uncategorized | Tagged: C#, Tips | Leave a Comment »