I'm using System.Web.Script.Serialization.JavaScriptSerializer to serialize an object to JSON, but there are some fields within the object which don't need to be serialized. In java I would mark them with the 'transient' keyword. Is there an equivalent keyword or standard practice in C#?
Asked
Active
Viewed 1.0k times
7
-
Read this http://www.codeproject.com/Articles/4881/A-Comparative-Study-of-Java-and-C and search to transient in the web page. – Nikhil Agrawal Jun 03 '15 at 19:38
1 Answers
13
Put [ScriptIgnore]
attribute on the property and it will not be serialized.

Habib
- 219,104
- 29
- 407
- 436