Skip to content

Instantly share code, notes, and snippets.

@rido-min
Created October 11, 2018 21:48
Show Gist options
  • Save rido-min/fa2ad69ad07f2731eb62a4feb359b650 to your computer and use it in GitHub Desktop.
Save rido-min/fa2ad69ad07f2731eb62a4feb359b650 to your computer and use it in GitHub Desktop.
class Program
{
async static Task GetFirstAudioDevice()
{
DeviceInformationCollection deviceInfoCollection = await DeviceInformation.FindAllAsync(DeviceClass.Location);
Console.WriteLine("The number of Location device:" + deviceInfoCollection.Count);
for (int i = 0; i < deviceInfoCollection.Count; i++)
{
DeviceInformation deviceInfo = await DeviceInformation.CreateFromIdAsync(deviceInfoCollection[i].Id, null, deviceInfoCollection[i].Kind);
Console.WriteLine("The Name of {0}th of Location device: {1}", i, deviceInfo.Name);
}
Console.WriteLine("Done");
}
[STAThread]
static void Main(string[] args)
{
GetFirstAudioDevice().Wait();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment