How exclude public property from object serialization?

  • Thread starter Thread starter Ed Sutton
  • Start date Start date
E

Ed Sutton

Is there an attribute I can add to a public get/set property to prevent
serialization?

I am using auto-generated object serialization for a custom type in my
webs service.

Thanks in advance for any tips or suggestions,

-Ed
 
You should be able to use [NonSerialized()] on the property. Ultimately, it
is a method as far as the compiled code is concerned (actually a s et of
methods, but who is counting).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 
[XmlIgnore]
Is there an attribute I can add to a public get/set property to prevent
serialization?

Sorry, I should have used Google to search Groups first. Usage example:

/// <summary>
/// The firmware this batch was programmed with
/// </summary>
[XmlIgnore]
public FirmwareRelease FirmwareVersion
{
get{ return (FirmwareRelease)this.firmwareRelease.InnerObject;}
set{ this.firmwareRelease.InnerObject = value; }
}

-Ed
 
Back
Top