Just as an FYI to everyone, I dont know if it is a bug in .net 1.0, but the
Structures were the problem. I was up late last night and moved everything
over to Classes and voila! Seems to be working fine now..... Is this a known
"RP" <rp@nospam.com> wrote in message
news:eI7YwOaAEHA.3940@TK2MSFTNGP11.phx.gbl...
> Sorry, the main class has nested Structures defined rather than classes.
> Could that be the problem?
>
> "Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
> news:Xns94A1E1F1AA08Fcrtimmonscrtimmonsin@207.46.248.16...
> > "RP" <rp@nospam.com> wrote in
> > news:eoduyKYAEHA.1468@tk2msftngp13.phx.gbl:
> >
> > > In my scenario instead of an actual int, i have a custom object
> > > called MyObject. And I try setting one of the properties in the
> > > eval. e.g. Evaluate("a.id = 2;"). when I check id, it is not 2.
> > >
> > > "RP" <rp@nospam.com> wrote in message
> > > news:e66ULDYAEHA.3944@TK2MSFTNGP11.phx.gbl...
> > >> Hi all, I am having a problem updating class-level variables in
> > >> eval statements. Take a look at the code:-
> > >>
> > >> class JavaService
> > >> {
> > >> var a: int = 0;
> > >>
> > >> function Evaluate(evalString : String)
> > >> {
> > >> return eval(evalString);
> > >> }
> > >> }
> > >>
> > >> When I call Evaluate("a = 10;"). It does not change a.
> > >>
> > >> Any ideas?
> > >>
> > >> TIA,
> > >> Param
> > >>
> > >>
> > >
> > >
> >
> > Param,
> >
> > This works for me (.Net 1.1):
> >
> > // Example.js
> > import System;
> >
> > var js = new JavaService();
> > js.Evaluate("mo.a = 10");
> > js.PrintA(); // Will print 10.
> >
> > public class JavaService
> > {
> > public var mo : MyObject = new MyObject(); // Can't be private.
> >
> > public function Evaluate(evalString : String)
> > {
> > return eval(evalString);
> > }
> >
> > public function PrintA()
> > {
> > Console.WriteLine(mo.a);
> > }
> > }
> >
> > public class MyObject
> > {
> > public var a : int = 0; // Can't be private.
> > }
> >
> >
> > Hope this helps.
> >
> > Chris.
> > -------------
> > C.R. Timmons Consulting, Inc.
> >
http://www.crtimmonsinc.com/ >
>