C#
# 내 컴퓨터의 컴퓨터 Description 가져오
악마성
2020. 1. 8. 10:58
728x90
반응형
public string getUserName()
{
string description = null;
using (ManagementClass mc = new ManagementClass("Win32_OperatingSystem"))
{
using (ManagementObjectCollection moc = mc.GetInstances())
{
foreach (ManagementObject mo in moc)
{
if (mo.Properties["Description"] != null)
{
description = mo.Properties["Description"].Value.ToString();
break;
}
}
}
}
char str = '/';
string[] str_sp = description.Split(str);
str = ';';
string[] info_userid = str_sp[2].Split(str);
return info_userid[1];
}
728x90
반응형