1

I am referencing a set of classes that exist in a 3rd party dll to run a search. These classes are bundled in one namespace in version A of this dll, but have been moved to another namespace in dll version B. The dlls have the same name, and my program needs to be able to run against both versions of this 3rd party program. For example:

A call with namespace prefix in version A for these classes would look like:

foo.bar.SearchClass = new foo.bar.SearchClass{x=1,y=2,z=3};
foo.bar.FoundObject = SearchClass.RunSearch()

And a call with namespace prefix in version B would look like:

foo.bar.search.SearchClass = new foo.bar.search.SearchClass{x=1,y=2,z=3};
foo.bar.search.FoundObject = SearchClassRunSearch();

The .search namespace is new to version B and does not exist in version A. But the classes are exactly the same; they've just been lifted from one namespace and plopped in this new one. How can I implement a check that sees what namespace that these referenced classes currently exist in?

JasonN
  • 11
  • 1
  • Why do you need to support both versions? – Fildor Jun 26 '19 at 14:36
  • You can [enumerate the types in a given namespace in a given assembly](https://stackoverflow.com/a/34869091/424129). You're going to to have to create this thing via reflection anyway, because you're compiling against one version or the other. Is this a situation where you have customers still using an old version of the third party product? – 15ee8f99-57ff-4f92-890c-b56153 Jun 26 '19 at 14:41
  • @Fildor Both versions exist in production and I'd like to just have one version of this app instead of maintaining two iterations. – JasonN Jun 26 '19 at 14:46
  • Isn't that dll under your control to deploy along with your App? So if YourApp version 1.5 is using ThirdParty.dll v 2.3 and ThirdParty.dll v 3.0 has that breaking change, you'd deploy YourApp version 2.0 with ThirdParty v 3.0, replacing the old one? – Fildor Jun 26 '19 at 14:50

0 Answers0