c# - Is it possible to write a .NET library that targets .NET 4.0 but uses .NET 4.5 features if invoked by a .NET 4.5 application? -


the library must able run on machines have .net 4.0. if run on machines have .net 4.5, , if invoked .net 4.5 application, nice if same library able use .net 4.5 specific functionality.

of course, hardcoding dependencies on types , methods not introduced until .net 4.5 make library no longer .net 4.0 compliant, possible .net 4.0 library loaded .net 4.5 application load , use .net 4.5 types , methods using reflection?

yes can,since @ disposal. 1 example paint.net does; compiler 4.0 if 4.5 installed, enables multi-core jit using reflection. can find details in http://blog.getpaint.net/2012/09/08/using-multi-core-jit-from-net-4-0-if-net-4-5-is-installed/


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -