Answers for "ex: Windows.Devices.Enumeration"

0

ex: Windows.Devices.Enumeration

using System;
using System.Threading.Tasks;
using Windows.Devices.Enumeration;

namespace DeviceEnumerationConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            EnumerateDevices().Wait();
        }

        static async Task EnumerateDevices()
        {
            DeviceInformationCollection dic = await DeviceInformation.FindAllAsync();
            foreach (DeviceInformation di in dic)
            {
                Console.WriteLine(di.Name + " : " + di.Id);
            }
        }
    }
}
Posted by: Guest on July-03-2021

Browse Popular Code Answers by Language