Suppose there is a code that uses external lib.

In the new version, one of the methods lost one of the overloads, but it was necessary that the code worked both there and there (with the old lib).

Yes, you can make a separate code for different versions of libraries, but is it possible to pervert with the preprocessor to replace all method calls ([some kind of variable]) with Method ([some kind of variable], 0)

  • Search with replacement for the whole project. - Alexander Petrov
  • Can work with reflection: determine the version of the library or the availability of an obsolete method, and, depending on the result, call one or another method? - Bulson

1 answer 1

Since the library interface is changing (and this, by the way, is not good), I would have wrapped the calls to it into a separate class. In this case, all changes will be local and easily visible.

There is no preprocessor like C / C ++ in C #. You can write your own, but it seems to me that the game is not worth the candle.