Extracting an interface from .NEt System classes

Posted by Thomas on Stack Overflow See other posts from Stack Overflow or by Thomas
Published on 2010-04-19T06:44:20Z Indexed on 2010/04/19 7:13 UTC
Read the original article Hit count: 275

When using Visual Studio it is easy to extract an interface from a class that I have written myself. I right click on the class and select 'Refactor' then select 'Extract Interface'.

Let's assume for a second that I wanted to create a ConfigurationManager wrapper and write some tests around it. A quick way to do that would be to extract an interface from ConfigurationManager by right clicking it, then 'Go To Definition' and then from inside the class select 'Refactor' then select 'Extract Interface'. Then I would simply create my wrapper class, inherit from my newly created interface, and then implement it and I have a great starting point for my wrapper class.

However, extracting an interface from any .NET system classes is not possible, probably because it's just meta data about the classes and not the classes themselves (or I am doing it wrong).

Is there an easy way to do what I am trying to accomplish? I want to ensure I am not wasting time typing what I don't need to be typing.

Thanks

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about visual-studio-2008