Create something like an insert code template?


When first implementing an explicit ISerializable  implementation it would be nice to generate a default implementation first. This feels like I could code a macro/code template/something to do this automatically but not sure where to start. I would want to grab all fields and implement a constructor like this

public $class(SerializationInfo info, StreamingContext context) {
$field0 = info.GetValue(nameof($field0), $field0);
// field1.. field2.. etc


public void GetObjectData(SerializationInfo info, StreamingContext context) {
info.AddValue(nameof($field0), $field0);
// field1.. field2.. etc

Is that possible? Any pointers to where to do it?
1 comment
Comment actions Permalink


Live Templates feature could help you. Please, let me know if you meet with any problems with it. 


Please sign in to leave a comment.