Although you may not like the answer, I think packaging would be the right choice.
For a third-party vendor code, packaging should only be required to obtain a level of abstraction for unit testing. And, as a wrapper, you can apparently mark methods as Obsolete .
For .NET objects, this is a little trickier. Obviously, someone can just turn on the namespace and go to the city; I do not believe that for this problem, as you want, there is a โonly codeโ solution, different from doing an integration test that searches for your solution and fails when that particular method is called that you donโt like.
source share