TO; tracked through a reflector. The only time a regular implementation uses this value is when processing some data through remote access, if the value returned from the HeaderHandler is MarshalByRefObject , in which case the identification is obtained and used to bind. Specifically, the constructor of System.Runtime.Remoting.Messaging.MethodCall .
But all this is an implementation detail! In most reasonable scenarios, the answer is this: it is not used.
In fact, the header processing has after the main deserialization, which blatantly violates the use of the header handler to set some values ββof the context object, which you then process.
However, your header handler can update local variables:
string someValue = null; object obj = serializer.Deserialize(source, headers => { // check the headers and assign someValue based on // what you find there; for brevity, make it up! someValue = "something from the headers"; return null; }); Console.WriteLine(someValue);
Must love full lexical closures.
Personally, however, I conclude: this is not a way to do this. I would just pass the DTO with exactly the data you want to send.
source share