浏览代码

Adding type reference sample

Sébastien Ros 8 年之前
父节点
当前提交
e0c2e2d37e
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      README.md

+ 8 - 0
README.md

@@ -102,6 +102,14 @@ and then to assign local namespaces the same way `System` does it for you, use `
     jint> var bar = new Foo.Bar();
     jint> log(bar.ToString());
 ```    
+adding a specific CLR type reference can be done like this
+```csharp
+engine.SetValue("TheType", TypeReference.CreateTypeReference(engine, typeof(TheType)))
+```
+and used this way
+```javascript
+    jint> var o = new TheType();
+```
 Generic types are also supported. Here is how to declare, instantiate and use a `List<string>`:
 ```javascript
     jint> var ListOfString = System.Collections.Generic.List(System.String);