.net - To check wether a specific project reference exists (C# Code, Preprocessor Directives ...) -


i'm new c# / .net hope there solution problem.

i'm working 2 different image-processing libraries have own classes represent images. because don't want use classes in own (private) class library, want implement own "myimage"-class supposed wrapper around both of other classes. (i have of course add functionality of libraries if missing).

my problem this: myimage-class needs reference both libraries compile, use myimage-class in projects 1 library available. find not difficult "add" or "remove" references image class project, don't want comment out code refers missing library.

so question is: somehow possible determine wether reference set preprocessing directive or attributes or code directly? or there better solution problem (a clever class design maybe?)

thanks help

i don't think there's preprocessor directive tell if reference has been added.

you split class 2 separate classes, 1 each library, suspect intention join 2 1 unified class.

what use 2 conditional compilation symbols (see properties | build), 1 methods specific first library, other second library. whenever class's code refers data members or functions specific the library, surrounded #if directive, referring appropriate symbol.

if intention not join classes, reed's , daniel's solutions more appropriate.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -