操作系统确定vb.net的代码 [英] OS Determine code for vb.net

查看:83
本文介绍了操作系统确定vb.net的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我需要一个vb.net代码来确定32位还是64位操作是?

hi all
i need a vb.net code to determine if 32 or 64 bit operation is ?

推荐答案

请参阅
http://channel9.msdn.com/Forums/TechOff/410567-C-Detect-32位或64位OS [ http://www.supportforums.net/showthread.php?tid=11587 [ ^ ].
See
http://channel9.msdn.com/Forums/TechOff/410567-C-Detect-32-bit-or-64-bit-OS[^]
http://www.supportforums.net/showthread.php?tid=11587[^].


您只需要知道调用者正在运行哪个代码:32位还是64位?就是这样,太简单了:

Do you only need to know which code is running by the caller: 32- or 64-bit? It this is just this, it''s way too simple:

static int HowManyBits {
    get {
        System.IntPtr ptr = System.IntPtr.Zero;
        return System.Runtime.InteropServices.Marshal.SizeOf(ptr) * 8;
    }
}



例如,



For example,

static void Main(string[] args) {
    System.Console.WriteLine( string.Format("{0}-bit", HowManyBit) );
}



将输出"32位"或"64位".

另请参阅我对Abhinav的答复的评论.

—SA



will output "32-bit" or "64-bit".

Please also see my comment to the Answer by Abhinav.

—SA


这篇关于操作系统确定vb.net的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆