如何固定一个值
public static string YingPan(){
ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
string strHardDiskID = null;
using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = managementObjectSearcher.Get().GetEnumerator())
{
if (enumerator.MoveNext())
{
strHardDiskID = ((ManagementObject)enumerator.Current)["SerialNumber"].ToString().Trim();
}
}
return strHardDiskID;
如何改,将YingPan值固定为一个值 这函数的返回值不就是电脑硬盘ID嘛?
想固定为一个值的话就在return strHardDiskID;上面加一句:strHardDiskID = "硬盘ID"; 网上找答案很多
页:
[1]