Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

The Windows 10 API provides API availability checks. So you target the latest version but then add checks to see what API's are available.

This is nice because it encapsulates both OS version API differences and device capabilities.

https://blogs.windows.com/buildingapps/2015/09/15/dynamicall...

    using Windows.Foundation.Metadata;
     
    if(ApiInformation.IsTypePresent("Windows.Media.Playlists.Playlist"))
    {
        await myAwesomePlaylist.SaveAsAsync( ... );
    }

    if(ApiInformation.IsApiContractPresent("Windows.Media.Playlists.PlaylistsContract"), 1, 0)
    {
       // Now I can use all PlayList APIs
    }


Unfortunately that's a Windows 10 API, meaning it isn't very useful for older versions of Windows!


In that case, you put your Windows 10 stuff in a different .dll that doesn't get deployed on old versions of Windows.

The article has an example.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: