0
で一覧で検索することが私のリストです:どのように最初の項目ここで
public static List<Tuple<string, string>> hardDiskInfo(string hostname)
{
var hardDiskInfo = new List<Tuple<string, string>>();
ManagementScope Scope;
if (!hostname.Equals("localhost", StringComparison.OrdinalIgnoreCase))
{
ConnectionOptions Conn = new ConnectionOptions();
Conn.Username = Properties.Settings.Default.uName;
Conn.Password = Properties.Settings.Default.pWord;
Conn.Authority = "ntlmdomain:" + Properties.Settings.Default.doMain;
Scope = new ManagementScope(String.Format("\\\\{0}\\root\\CIMV2", hostname), Conn);
}
else
Scope = new ManagementScope(String.Format("\\\\{0}\\root\\CIMV2", hostname), null);
Scope.Connect();
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_LogicalDisk WHERE DriveType = 3 OR DriveType = 4");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(Scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject mo in queryCollection)
{
foreach (PropertyData p in mo.Properties)
{
if (p.Value != null)
{
hardDiskInfo.Add(new Tuple<string, string>(p.Name.ToString(), p.Value.ToString()));
}
}
}
return hardDiskInfo;
}
私はそれを呼び出した後p.Nameの第二p.Valueを取得する方法を知りたい:
hardDiskInfo(inputText.Text);
たとえば、 "FreeSpace"の値はWin32_LogicalDiskで定義されています。
私はこれを知っているので、私はそれらのすべてを扱うのに役立ち、私は幸せなパンダになるでしょう。
ありがとうございます。
_P.Nameの2番目のp.Valueを取得する方法を知りたい場合は、それを呼び出した後に_ _秒の値はありませんか? –
オクラホマ、悪い。ですから、p.Nameのp.Valueを取得する方法を知りたいと思います。 – Nash
NameValueコレクションのように見えるので、 'p'は' Name'と 'Value'を持っています。意味は、 'Name'それ自身は名前の値であり、' Value'は値を含んでいます。私は闘争が何であるかを理解できないかもしれません。 –