Пример #1
0
 private Jurassic.Library.ObjectInstance GetObject(object obj)
 {
     var type = obj.GetType();
     var inst = new Object(_ctx);
     foreach (var prop in type.GetProperties()) {
         var value = prop.GetValue(obj, null);
         if (!prop.PropertyType.IsValueType && prop.PropertyType != typeof(string) && value != null) {
             value = GetObject(value);
         }
         inst.DefineProperty(prop.Name, new Jurassic.Library.PropertyDescriptor(value, Jurassic.Library.PropertyAttributes.FullAccess), true);
     }
     return inst;
 }