Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / July 2003

Tip: Looking for answers? Try searching our database.

Inherit JScript.ArrayObject and pass it to VSA?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
boogs - 01 Jul 2003 20:42 GMT
Hello,

Is there a way to inherit Microsoft.JScript.ArrayObject? I have done
something similar with JSObject and it works great.

The reason why I need to is because I'm actually faking JScript
datastructures by wrapping JSObject around an XML Dom. When the JScript
engine makes changes to it's objects, the xml structures are updated.

ArrayObject, however, has no public constructors making it difficult to
inherit. Is there a way I can do something similar? I have considered
inheriting ArrayList, but that means I need to expose mscorlib to the script
engine (for System.Collections) which is something I don't really want to
do.

I also considered simply creating a real .NET Array and passing it to VSA,
but this means that I can't give real-time feedback to the script when it
tries to do something bad, like assign more than the maximum number of
elements allowed by the business rules or whatever.

Thanks for any help,

Signature

Aaron

Peter Torr \(MS\) - 04 Jul 2003 23:05 GMT
> Is there a way to inherit Microsoft.JScript.ArrayObject? I have done
> something similar with JSObject and it works great.

No, not really. That's not a supported scenario.

Nevertheless, if you want to write brittle and non-supportable could, you
*could* hand-compile some IL that called the private constructor for you. As
long as your code is granted "SkipVerification" permission (all FullTrust
code has this) then it should succeed. In theory.

I do not recommend this at all though.

Basically you would write a simple "MyArrayObject" in IL that did nothing
except expose a public constructor that called the ArrayObject's private
constructor. Then you'd inherit from this in your other code and do all the
work you wanted (ie, you only have to write the intermediate wrapper in IL,
not your whole program).

Again, I DO NOT RECOMMEND THIS!

> The reason why I need to is because I'm actually faking JScript
> datastructures by wrapping JSObject around an XML Dom. When the JScript
> engine makes changes to it's objects, the xml structures are updated.

Sounds interesting... ;-)

> ArrayObject, however, has no public constructors making it difficult to
> inherit. Is there a way I can do something similar? I have considered
> inheriting ArrayList, but that means I need to expose mscorlib to the script
> engine (for System.Collections) which is something I don't really want to
> do.

Every .NET assembly binds to mscorlib. It has stuff like String and Int32 in
it.

Peter

Signature

Please post questions to the newsgroup - everyone benefits.
This post is provided "AS IS" with no warranties, and confers no rights
Sample code subject to http://www.microsoft.com/info/cpyright.htm


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.