How extension method works in .Net

What is extension method Here is the Wikipedia definition - In object-oriented computer programming, an extension method is a method added to an object after the original object was compiled. The modified object is often a class, a prototype or a type. Extension methods are permitted by some object-oriented programming...


Why you shouldn't believe in your favorite .net decompiler

Yesterday I posted about explicit interface implementation. I was curious about to know how CLR treats Explicit interface implementation. I looked into the generated IL code using IL DASM, and it was pretty similar to C# code I wrote. So I thought of reverse engineering the assembly. I verified the...


Explicit Interface Implementation in C#

If a class implements two interfaces that contain a member with the same signature, then implementing that member on the class will cause both interfaces to use that member as their implementation. class Sample : ISample, ISample2 { //Both ISample and ISample2 will call this method. public int Add(int a,...


Download .NET Architecture Universe Poster - 2014

.NET Universe Poster (2014) showing the main .NET SDKs, libraries and packages classified by application type and package type (NuGet, official support, etc.) You can download it from here


No more annual renewal fee for Windows developer accounts

Windows Dev Center requires only a one-time registration payment, which grants developers the ability to submit apps to both the Windows Store and Windows Phone Store, with no annual renewal fee. And this is applicable for the existing developers as well. You can find more details about it from Account...


CreateObject equivalent for C#

In current project, I had to use some 3rd party APIs, which is exposed via COM Interop. I found some VB.Net code to consume, but I couldn’t find in C# implementation for the same. Here is the code snippet which is equivalent VB.Net CreateObject method. var txt = "HelloWorld"; var...


Serializing .NET dictionary

Recently I had to implement XML Serialization in one of my class, it was deriving from base class, which has a dictionary property and XML Serialization was failing due to that. And here is the code snippet which will help you to serialize a .Net dictionary. It is implemented using...


OpenXML and opening a file in Read only mode

In one of my project, I am using OpenXML SDK for opening Excel files. Recently I got an issue like SpreadsheetDocument.Open() method was throwing an IOException, if the Excel file is opened by MS Excel, even if I set the isEditable parameter false. I fixed this problem by passing a...