CsWinRT icon indicating copy to clipboard operation
CsWinRT copied to clipboard

Question: How to convert `WinRT.IInspectable` to `Windows.Foundation.Collections.IObservableVector`?

Open shelllet opened this issue 4 years ago • 3 comments

image

image

shelllet avatar Aug 27 '21 14:08 shelllet

Hi @shelllet, do you have a repro/stack of the above code?

angelazhangmsft avatar Aug 31 '21 16:08 angelazhangmsft

Hi @shelllet, do you have a repro/stack of the above code?

it's easy!, https://github.com/shelllet/WinRT_IInspectable

shelllet avatar Sep 01 '21 01:09 shelllet

Thanks! It looks like there is a workaround:

var listcast = (IObservableVector<int>)(object)(iis)

We will need to investigate why the direct As<> cast causes an exception.

angelazhangmsft avatar Sep 01 '21 17:09 angelazhangmsft