Description
When I use event methods for the DataContractSerializer
system, I still need a StreamingContext
parameter even though the BinaryFormatter
stuff is deprecated. The constructor and state property of StreamingContext
is marked as obsolete.
The StreamingContext _
parameter is unused in the below code. I feel it is redundant.
[OnSerializing()]
void OnSerializing(StreamingContext _) { ... }
[OnSerialized()]
void OnSerializing(StreamingContext _) { ... }
[OnDeserializing()]
void OnSerializing(StreamingContext _) { ... }
[OnDeserialized()]
void OnSerializing(StreamingContext _) { ... }
Parameter-less one like the code below makes me feel refreshed. Also, we do not need to type unused parameters. So, developing efficiency is more improved. In addition, maybe, passing (copying structure data) the parameter makes a program slow. Or maybe, the speed is the same because of checking parameters.
[OnSerializing()]
void OnSerializing() { ... }
[OnSerialized()]
void OnSerializing() { ... }
[OnDeserializing()]
void OnSerializing() { ... }
[OnDeserialized()]
void OnSerializing() { ... }
I agree that we should still support with StreamingContext _
parameter for compatibility but I want a parameter-less option.