I have no experience in using C# .Net. I have one small question. I have a library written in .Net framework 2. Will i be able to import it and use it in .Net framework 4 ?.
问题:
回答1:
Yes, you can reference a 2.0 class library from an application of a higher framework version, but not the other way around.
回答2:
You can always check the .NET Version Compatibility. (There are some caveats moving to 4, but generally speaking you should be fine.)
Any problems you might see would arise from a version previous to 2. (Though I hear past 4 is a re-write, so I'm not sure how they are handling backwards compatibility. I'm sure they have to keep it safe, as no many people want to side-load two .net versions).
回答3:
By library, you mean a DLL right? If so, you should be fine - but it's the application that loads your DLL that has control over the .net CLR that's used.
This is done via app.config, you might find this helpful: What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?