最新長(zhǎng)月?tīng)a明大全
人的記憶力會(huì)隨著歲月的流逝而衰退,寫(xiě)作可以彌補(bǔ)記憶的不足,將曾經(jīng)的人生經(jīng)歷和感悟記錄下來(lái),也便于保存一份美好的回憶。那么我們?cè)撊绾螌?xiě)一篇較為完美的范文呢?以下是小編為大家收集的優(yōu)秀范文,歡迎大家分享閱讀。
長(zhǎng)月?tīng)a明篇一
本文實(shí)例為大家分享了c#檢測(cè)操作系統(tǒng)版本的方法,供大家參考,具體內(nèi)容如下
n獲得操作系統(tǒng)的`版本號(hào),然后再根據(jù)版本號(hào)進(jìn)行判斷操作系統(tǒng)是什么版本。
version 類(lèi)的屬性
參考于:https:///zh-cn/library/windows/desktop/ms724834(v=vs.85).aspx
注意:在msdn官方文檔有說(shuō)明 → osversion 屬性報(bào)告兩個(gè)相同的版本號(hào) (6.2.0.0) windows 8 和 windows 8.1。在某些情況下, osversion 屬性可能不會(huì)返回與指定的 windows 程序兼容性模式功能的版本相匹配的操作系統(tǒng)版本。
代碼:
public class getosystem{private const string windows2000 = "5.0";private const string windowsxp = "5.1";private const string windows2003 = "5.2";private const string windows2008 = "6.0";private const string windows7 = "6.1";private const string windows8orwindows81 = "6.2";private const string windows10 = "10.0";private string osystemname;public void setosystemname(string osystemname){mname = osystemname;}public getosystem(){switch ( + "." + ){case windows2000:setosystemname("windows2000");break;case windowsxp:setosystemname("windowsxp");break;case windows2003:setosystemname("windows2003");break;case windows2008:setosystemname("windows2008");break;case windows7:setosystemname("windows7");break;case windows8orwindows81:setosystemname("ows8.1");break;case windows10:setosystemname("windows10");break;}ine(osystemname);}}class program{static void main(string[] args){#region 檢測(cè)系統(tǒng)new getosystem();#endregion}}
輸出結(jié)果:
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持。
s("content_relate");【c#檢測(cè)操作系統(tǒng)版本的方法匯總】相關(guān)文章:
1.
獲取當(dāng)前操作系統(tǒng)的軟件版本
2.關(guān)于linux查看系統(tǒng)版本的方法匯總
3.kmp算法的c#實(shí)現(xiàn)方法
4.操作系統(tǒng)打補(bǔ)丁的方法
5.快速安裝操作系統(tǒng)的方法
6.操作系統(tǒng)打補(bǔ)丁的方法
7.安裝電腦的操作系統(tǒng)的方法
8.unix操作系統(tǒng)關(guān)機(jī)方法