Re: Detecting If A Namespace Is Available
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Wed, 04 Feb 2009 11:02:50 -0800
On Wed, 04 Feb 2009 04:58:05 -0800, Justin R. <JRusbatch@xxxxxxxxx> wrote:
Is it possible to structure a program in a way that it could, for
instance, utilize LINQ if .NET 3.5 is installed, but not if the client
only has .NET 2.0?
It should be. Not that I've actually tried it myself though.
What I would do: configure the project to target 2.0. Write wrappers for the .NET 3.5 features I want to use. On initialization, attempt to load the .NET assemblies where those features are located, and if successful, use Reflection to obtain references to the appropriate class members, which then can be used to delegate the features advertised by your wrappers. For static members, you can do this right away. For instance members, you'll do it when an instance of your wrapper class is created.
All that said, while this technique would be useful for certain kinds of things, it seems to me that for most things it's not. After all, if you want to support .NET 2.0, you have to have an alternative implementation and frankly, if that implementation is good enough for .NET 2.0 users, it should be good enough for everyone. And while there may be some addition maintenance issues for situations where you have to essentially reinvent the wheel, it seems to me those maintenance issues are less of a problem than trying to maintain code that does the above.
Pete
.
- References:
- Detecting If A Namespace Is Available
- From: Justin R.
- Detecting If A Namespace Is Available
- Prev by Date: Re: Behavior Explaination
- Next by Date: Re: Alternative to Brittle Code? - Adding New Properties to Class Over Time
- Previous by thread: Re: Detecting If A Namespace Is Available
- Next by thread: Get return value sent by web-site
- Index(es):
Relevant Pages
|