Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass javascript object to winrt component written in C#

I have created a WinRT component in C# which accepts a collection as a parameter.

namespace MyNamespace {
  public sealed class MyClass {
    public MyFunction(IReadOnlyDictionary<string, string> properties) {
    }
  }
}

I am trying to use this component in javascript as follows:

var x = new MyNamespace.MyClass();
x.MyFunction({'aaa': 'bbbb'});

I am not sure why this is not working. Any Ideas?

like image 389
Avi Avatar asked Mar 08 '26 10:03

Avi


1 Answers

I think this is your answer.

var ps = new Windows.Foundation.Collections.PropertySet();
ps['aaa'] = "bbb";

var x = new MyNamespace.MyClass();
x.MyFunction(ps);

"Your WinRT component will need to expose (or reuse) a concrete class implementing the specific instantiation of IMap that you need..."

like image 54
Colin Pear Avatar answered Mar 10 '26 00:03

Colin Pear



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!