0

Is there a way to hook into how specific types are serialized when using WCF and Silverlight. For example, I need to tweak how System.DateTime properties are serialized/deserialized.

3 Answers 3

1

Be careful here. Any time you change how something is serialized, you'll also have to change how the client deserializes it. You should have a very good reason in mind before changing how a data contract serializes, as they are made to be very interoperable. Anything you change could reduce the level of interoperability.

Sign up to request clarification or add additional context in comments.

Comments

0

In your datacontract, use the [OnSerialized] attribute.

1 Comment

Unfortunately, Silverlight doesn't support serialization callbacks. See my complaint <a href="blog.wouldbetheologian.com/2009/10/…>.
0

Since Silverlight doesn't support serialization callbacks (see here), you best bet might be to add a secondary property to any objects which wraps the DateTime property you need to control, and handle any "serialization" needs in that property.

Just a thought.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.