Q: Find out DirectX Version how can you detect if the directx version on a windows 7 machine is 11 or 11.1 ?
preferably using a .NET language maybe via PInvoke or SharpDX?

A: Just try to create a device with a specific feature level (along with other parameters).


*

*In native code (use one of the D3D11CreateDevice* functions) . If function will not succeed - feature level is not supported. To make it easier, we usually pass array of feature levels, and then, if device is not nullptr, we can check which one is highest supported:
const D3D_FEATURE_LEVEL arrFeatLevels[] = 
{
    D3D_FEATURE_LEVEL_11_1, 
    D3D_FEATURE_LEVEL_11_0,
    D3D_FEATURE_LEVEL_10_1, 
    D3D_FEATURE_LEVEL_10_0,
    D3D_FEATURE_LEVEL_9_3, 
    D3D_FEATURE_LEVEL_9_2,
    D3D_FEATURE_LEVEL_9_1, 
};

const unsigned int nFeatLevels = _countof(arrFeatLevels);

D3D11CreateDeviceAndSwapChain(..., arrFeatLevels, nFeatLevels, ..., 
                                   &m_Device, &featureLevel, &m_Context);
if (m_Device && m_Context)
{
    featureLevel // you can access to highest supported feature level here


*In SharpDX you will need to use constructor, which accepts specific feature levels:
Device(DriverType, DeviceCreationFlags, FeatureLevel[])

if device creation succeeded, then check Device.FeatureLevel property.
Happy coding!
Edit
I think I misinterpret your question. You asked about detecting of which version is supported by OS, not by OS + graphics card + driver all together. Maximum supported version are preinstalled with OS, so you only need to know which OS are you on:
OS version                      Version of DX runtime

Windows Vista                   DirectX 10
Windows Vista SP1/SP2           DirectX 10.1
Windows Vista SP2               DirectX 11.0
Windows 7                       DirectX 11.0
Windows 7 SP1                   DirectX 11.0
Windows 7 SP1 with KB2670838    DirectX 11.1
Windows 8 / Windows RT          DirectX 11.1
Windows 8.1 / Windows RT        DirectX 11.2

sources: 


*

*Wikipedia: DirectX#Releases

*DirectX 11.1 and Windows 7 Update
You can also query version of d3d11.dll and compare with those which are on wiki page.
See:


*

*c++ How do I programatically get the version of a DLL or EXE file?

*c# How to get .exe file version number from file path
