3 ms·
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
by becarefulyo 10y ago
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/dynamically-detecting-features-with-api-contracts-10-by-10/ 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
}
- rymate1234 10y agoUnfortunately that's a Windows 10 API, meaning it isn't very useful for older versions of Windows!
- becarefulyo 10y agoIn 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.