I have an existing application which is already developed and is in use.
There are multiple overloads of one of the methods (called Read()) of a class. Now I want to introduce my method in that class which should be executed before or after any of the overloads of the Read() method is called. Which overload of the Read() method will be called is decided at run time depending on the user input.
What do i need to do in this case? How my method will be executed before or after executing any of the existing overloads of Read() method?
Have a generic method
You need to use an Interceptor / AoP. The first options that jump to mind are PostSharp and Microsoft Unity.
There's a very good article on this sort of thing in this months MSDN magazine: http://msdn.microsoft.com/en-us/magazine/gg490353.aspx