Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

DataContractJsonSerializer adding custom parameters to StreamingContext

$
0
0

I'm using DataContractJsonSerializer to do custom deserializing of JSON text.

When the JSON deserializes and the OnDeserialized method is called there is a StreamingContext parameter.

Is it possible to add custom data to the StreamingContext beforehand, so that it can be accessed in the StreamingContext parameter at deserialization time?  There is additional data that I need to complete deserialization that cannot be easily accessed during deserialization.

        [OnDeserialized]
        internal void OnDeserialized(StreamingContext context) 
       {
            string customData = context.Context.foo;
       }


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>