I have a class object System.Windows.Documents.Run, I need it to copy. There are options other than manually?
I have a class object System.Windows.Documents.Run, I need it to copy. There are options
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Serialization is a common way to clone an object (if you don’t want to code it manually) – is is serializable? (or: could it be?)
This has the advantage of being a deep clone and maintenance-free, but is slower (how much slower depends on the serializer chosen).
Note: if you choose to use
BinaryFormatter, make sure you mark any events as[field:NonSerialized].BinaryFormatterisn’t my preferred serializer, but it is acceptable for in-memory cloning purposes (and is simple to get working – just mark your types as[Serializable]).