What is the best way to prevent C# programmer from using particular library class?
Class is from external assembly so it is impossible to use [Obsolete]
attribute on it. I tried to use Resharper custom patterns but it seems not to support generics types.
Patch the library method/class (there are several plugins for Reflector) - add DeprecatedAttribute
, or modify its code to throw an exception, for example.
You can also make a special unit test which runs at CI server and fails if a particular deprecated item usage indicated.
You can disassemble the library with ildasm, add [Obsolete(true)]
attributes and reassemble with ilasm.
You might be able to find some assembly edit tool, like Reflexil together with a trial of Reflector.
Note that if you edit an assembly you loose all signing and stuff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With