список возвращается обратно System.Collections.Generic.List

        private static List<string> GetHardwareInfo(string WIN32_Class, string ClassItemField)
        {
            List<string> result = new List<string>();

            ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM " + WIN32_Class);

            try
            {
                foreach (ManagementObject obj in searcher.Get())
                {
                    result.Add(obj[ClassItemField].ToString().Trim());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return result;
        }

        static void Main(string[] args)
        {
            var mem_type = GetHardwareInfo("Win32_PhysicalMemory", "MemoryType");
                Console.WriteLine(mem_type[0]);
            Console.ReadKey();
        }

Вызываю из списка переменной значение, но оно возращает список. System.Collections.Generic.List1[System.String]

или просто 0


Ответы (0 шт):