Freesnöw
Freesnöw

Reputation: 32143

How do I make certain properties not serialized when cloning?

I'm utilizing this guide here to allow me to clone certain objects in my project. I have one object that has a property that references a particular object. This particular object is from another library that I'm utilizing and is generated based off of the settings of my object. The problem is that when I go to copy my objects, everything goes crazy because it tries to copy EVERYTHING. Does anybody know how I can make this particular property ignored so that I can have it generate it itself upon cloning based on its settings?

I'm using VB.NET so all .NET answers are helpful.

Upvotes: 0

Views: 74

Answers (1)

Daniel DiPaolo
Daniel DiPaolo

Reputation: 56390

I believe you can apply the [NonSerialized] attribute to any field you don't want to be serialized.

Upvotes: 2

Related Questions