Being new to VB, I'm trying to understand what a construct like ["name"] means and how to use it. I thought anything with brackets is an escaped variable to allow using keywords like boolean, as in [boolean]. But I don't get this construct, especially in conjuction with an object, as in mo["name"] in the example below. Is mo["name"] an array element? What exactly is it and how do you use it?
Console.WriteLi ne("Computer details retrieved using Windows Management Instrumentation (WMI)");
ManagementObjec tSearcher query1 = new ManagementObjec tSearcher("SELE CT * FROM Win32_Operating System");
ManagementObjec tCollection queryCollection 1 = query1.Get();
foreach (ManagementObje ct mo in queryCollection 1)
{
Console.WriteLi ne("Name : " + mo["name"].ToString());
Console.WriteLi ne("Version : " + mo["version"].ToString());
}
Console.WriteLi ne("Computer details retrieved using Windows Management Instrumentation (WMI)");
ManagementObjec tSearcher query1 = new ManagementObjec tSearcher("SELE CT * FROM Win32_Operating System");
ManagementObjec tCollection queryCollection 1 = query1.Get();
foreach (ManagementObje ct mo in queryCollection 1)
{
Console.WriteLi ne("Name : " + mo["name"].ToString());
Console.WriteLi ne("Version : " + mo["version"].ToString());
}
Comment