Is it possible to disables that JS changes propeties of a object

Jun 24, 2013 at 3:07 AM
Edited Jun 24, 2013 at 3:08 AM
Example
Here is a object student which has some properties.
But the I just want the JS get the value but can not changess the value.

I have used Clone method. so every JS engine access a different copy object. But It seems that I get memory leak.
Coordinator
Jun 24, 2013 at 2:13 PM
Edited Aug 3, 2013 at 3:20 AM
Greetings!

If a property must be publicly writable on the host but read-only for script code, you can do something like this:
// C#
public class Student
{
    [ScriptMember(ScriptAccess.ReadOnly)]
    public string Name { get; set; }
}
Good luck!