func init // adds using namespace sys.add_use('System') sys.add_use('System.Collections.ObjectModel') // gets type of an array if(not isdef("ElementType")) this.type = code(this.props("ElementType").value.props("TypeName").value) if(this.type == 'Object undefined') error(this.name + ' - property ' + this.props("ElementType").name + ' does not defined') end end // initialize instance if(linked("Result") and linked("doReadOnly")) sys.add_var(this.name, 'dynamic') end end func doReadOnly(data) if(linked("Result")) blk.println(this.codename, ' = ', this.make_result(data), ';') event("onResult", this.codename) else event("onResult", this.make_result(data)) end end func Result if(linked("doReadOnly")) return(this.codename) else return(this.make_result()) end end func make_result(data) return('Array.AsReadOnly' + (isdef("ElementType") ? '' : '<' + this.type + '>') + '(' + d("Array") + ')') end