Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Generic types

0
0
Hi,

Is there is a way to use a generic type with a javascript class ?
For example, with the List<T> dotnet Framework class, If I define a javascript class "MyClass", is it possible to have a List<MyClass> ?

Here a pseudo code (that does not run) :
C# :
engine.AddHostObject("DotNet", new HostTypeCollection("mscorlib", "System.Core", "System.Data"));
Javascript
engine.Execute(@"
    function MyClass() {
        this.MyValue = 10;
    }
    var list = host.newObj(DotNet.System.Collections.Generic.List(MyClass));
");
Thanks for advance
Sybaris

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images