I have code 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 a structure StreamingContext. I found some links that this can be done for NetDataContractSerializer, but not for DataContractSerializer.
- Is there any way to make this work?
- Am I just doing it wrong?
source
share