Browse Source

Added example for generics support

Sébastien Ros 11 years ago
parent
commit
e2b861b556
1 changed files with 9 additions and 0 deletions
  1. 9 0
      README.md

+ 9 - 0
README.md

@@ -95,6 +95,15 @@ and then to assign local namespaces the same way `System` does it for you, use `
     jint> var bar = new Foo.Bar();
     jint> var bar = new Foo.Bar();
     jint> log(bar.ToString());
     jint> log(bar.ToString());
 ```    
 ```    
+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);
+    jint> var list = new ListOfString();
+    jint> list.Add('foo');
+    jint> list.Add(1); // automatically converted to String
+    jint> list.Count; // 2
+```
+
 ## Implemented features:
 ## Implemented features:
 
 
 - ECMAScript 5.1 test suite (http://test262.ecmascript.org/) 
 - ECMAScript 5.1 test suite (http://test262.ecmascript.org/)