Returing .net object

Oct 11, 2013 at 6:13 AM

I have .net class say person
namespace Jam{

public class Person{
public string name;
public string telephone;

public class PersonDB
public static Person GetRandomPerson()
   Person t = new Person(); = "test1"; t.telephone = "00500";
   return t;


Inside my Javascript when I call:

var person1 = PersonDB.GetRandomPerson();

Now person1 is a type of object.
person1.toString() will return "Jam.Person"

But when I access or person1.telephone it will return undefined

Jun 14, 2014 at 5:45 AM
Set your function "GetRandomPerson" to not static and when u calling "person1.toString();" you calling the object what you returned in your class "public Person GetRandomPerson()".
class Person is not a script but an object, try in your script "" or another variable from Person object.