Does GenerateScriptType support NonSerialized?
Posted
by BlueFox
on Stack Overflow
See other posts from Stack Overflow
or by BlueFox
Published on 2010-05-26T18:19:08Z
Indexed on
2010/05/26
18:21 UTC
Read the original article
Hit count: 141
I have an object that's used both on the client and server side.
GenerateScriptType(typeof(MyClass))
However, there are some fields that I don't need on the client, so my question is there any way to prevent those fields being serialized? (For example, Field2 and Field3 in MyClass)
I tried marking the fields with [NonSerialized] but they still get serialized...
public class MyClass
{
public string Field1;
public string Field2
{
get;
set;
}
private string _field3;
public string Field3
{
get
{
return _field3 ?? (_field3 = "lala");
}
}
}
Regards,
© Stack Overflow or respective owner