Able to specify alternative to "undefined"?

Sep 1, 2011 at 8:22 PM

I have a particular object type that I'd like to have any "undefined" members not be undefined.  I'd like them to actually be some other CLR class and on first reference, new a CLR object and add it to the objects member list.

For example:


At the point of looking at "something_undefined", I'd like for it to create a new instance of a CLR class and assign it to myobj, then call Go().

Is this possible?


Sep 2, 2011 at 11:40 PM

Yes, it's possible, you need to create you own class, derive if from 'JsObject' and override 'TryGetDescriptor' method, to make him creating missing properties at access attempts.