I have some code something like this:
[DataContract]
class Foo {
[OnSerializing]
private void BeforeSerialize(StreamingContext ctx)
{
((MtType)ctx.Context).DoStuff()
}
...
}
var reader = new XmlTextReader(filename);
var serializer = new DataContractSerializer(typeof(Type));
Type type = (Type)serializer.ReadObject(reader);
and I need to provide the StreamingContext
structure. I have found several references that this can be done for NetDataContractSerializer
but none for DataContractSerializer
.
- Is there a way to make this work?
- Am I just doing this wrong?