0
我想寫一個小的web.config讀取類,並希望它可用於我寫的所有.net框架解決方案。編寫一個交叉框架類,ConfigurationManager和ConfigurationSettings
一切都很好,除了.net 1.1及以下版本,我需要使用System.configuration.configurationsettings.appsettings和1.1後使用 System.configuration.configurationmanager.appsettings。
這是在一分鐘有點沮喪,我想弄清楚有沒有辦法做到以下僞代碼
if environment.version.major < 2 then
use configurationsettings.appsettings
else
use configurationmanager.appsettings.
end if
我試用了一下使用type.gettype繞過它,但我認爲這一定是一個簡單的解決方案,別人有一個簡潔的答案。
我們大多數人通過升級解決了這個問題。 .NET 4.0現在處於Release Candidate中。你仍然在使用.NET 1.1。提示提示。 – 2010-02-17 14:41:44
哈哈,不是我的選擇伴侶。有遺留的應用程序支持。我們不可能都是開拓者。該解決方案的最新版本是3.5,但我沒有選擇拋棄1.1版本。 我可以解決它,但我很狡猾。 – pflangan 2010-02-17 14:57:14