Q:

How to enumerate audio input devices in c# in windows 10 and > .net 4.5? 

How can I get a list of the installed audio input devices on a windows system ? 
OS: Windows(10) Framework: .Net >= 4.5 Language: c#
I have already tried to use this :
 ManagementObjectSearcher objSearcher = new ManagementObjectSearcher(
   "SELECT * FROM Win32_SoundDevice");

 ManagementObjectCollection objCollection = objSearcher. Get();

But this gives me a list of all devices, I just need the input devices list

A:

You can use DirectSoundCaptureEnumerate:
using System;
using System. Collections. Generic;
using System. Runtime. InteropServices;
public class DirectSoundDevices
{
    [DllImport("dsound.dll", CharSet = CharSet. Ansi)]
    static extern void DirectSoundCaptureEnumerate(DSEnumCallback callback, IntPtr context);
    delegate bool DSEnumCallback([MarshalAs(UnmanagedType. LPStruct)] Guid guid,
        string description, string module, IntPtr lpContext);
    static bool EnumCallback(Guid guid, string description, string module, IntPtr context)
    {
        if (guid ! = Guid. Empty)
            captureDevices. Add(new DirectSoundDeviceInfo(guid, description, module));
        return true;
    }
    private static List<DirectSoundDeviceInfo> captureDevices;
    public static IEnumerable<DirectSoundDeviceInfo> GetCaptureDevices()
    {
        captureDevices = new List<DirectSoundDeviceInfo>();
        DirectSoundCaptureEnumerate(new DSEnumCallback(EnumCallback), IntPtr. Zero);
        return captureDevices;
    }
}
public class DirectSoundDeviceInfo
{
    public DirectSoundDeviceInfo(Guid guid, string description, string module)
    { Guid = guid; Description = description; Module = module; }
    public Guid Guid { get; }
    public string Description { get; }
    public string Module { get; }
}

You can also use waveInGetDevCaps but for name of device, it returns first 32 characters of device name.