I have a small piece of code that tests if a variable implements IConvertible
by using x is IConvertible
. I have three different projects running the same code. One for .Net4.0, one for .Net4.5 (both working fine) and one for WinRT/NetFX/Metro which of course doesn’t work.
Inspecting e.g Int32
in the reference: .NET for Windows Store apps
; for the WinRT lib, in the Object browser, reveals an implementation of IConvertible
but the compiler can not resolve it.
To ensure I hadn’t messed to much up, I created a new solution, with a Windows store apps Unit test library
and a new Windows store Class library
. Pure Microsoft stuff. The test looks like this:
And a simple implementation for extracting the interface from Int32
:
It can resolve the interface, but I can’t use it in code. There are no more references I can add to the project and I haven’t found a BCL extension distributed as a NuGet that I can use as a standin.
I know WinRT isn’t .Net, but instead, it supports a subset of .Net. For me, it sometimes feels like it would make more sense to not support anything of the .Net API and instead go all new instead of making it hard for us to have it coexist with each other, as I do think issues like these make it a to limited subset.
Anyway, if you can spread light on the issue, I’m more than grateful.
Thanks,
//Daniel