Access a .Net type's field

Mar 2, 2011 at 3:46 AM

I'm trying a fairly simple proof of concept, and am having troubles:

 

public class Agreement
{
  public int ContractNumber { get; set; }
  public List<MemberInformation> Members { get; set; }
}

public class MemberInformation
{
  public string FirstName { get; set; }
  public string LastName { get; set; }
}


JavascriptContext ctx = new Noesis.Javascript.JavascriptContext();

Agreement a = /* instantiate agreement here */;

ctx.SetParameter("agreement", a);

 

In any script I run, I can't seem to access properties like length or Count on "agreement.Members", but I can access "agreement.Members[0].FirstName"...what am I missing?

 

Mar 2, 2011 at 3:51 AM

Alternately, I've tried this:

 

ctx.SetParameter("agreement", SerializeToJSON(a));

string script = @"

var s = eval(agreement); /* or var s = agreement; */

";

With no luck either.

Mar 2, 2011 at 4:18 AM

Omg. Never mind. :) User error....so far everything looks good :D