Monday, April 6, 2015

out variables return new instances of reference types

My Hydrate method here was to look like this:

public override void Hydrate(string packet)
{
   Exception exception;
   WebServiceVersion13 referenceTrick = this;
   WebServiceVersion13.Deserialize(packet, out referenceTrick, out exception);
}

 
 

...but Xsd2Code++ would really need to allow me to hand in a ref variable for a variable passed as a reference to be affected (hydrated) instead of an out variable which is just going to uselessly return a new instance of WebServiceVersion13 thus keeping me from altering "this" as desired. My superior ended up telling me to just use a case/switch statement instead of polymorphism today so all of the stuff I thought was superslick on Friday has been rolled back. Oh well. It was fun and it's all good.

No comments:

Post a Comment