mardi 13 novembre 2018

How do I get the type of `Tuple

I am writing a T4 template to generate some interfaces based on classes in an assembly.

One of the class methods returns a Tuple<VRTSystemInfoOverview, DateTime?>, but the MethodInfo.ReturnType.Name gives this as TupleOfVRTSystemInfoOverviewNullableOfdateTimefTWEG83G. I need to deconstruct this into Tuple<VRTSystemInfoOverview, DateTime?> for when I write the method in the interface.

I found this SO post, but unfortunately, the advice there didn't work in this case. The reply from dasblinkenlight returned false, possibly as I'm using C#6. For the same reason, I couldn't use Peter's reply, as ITuple wasn't in C#6. James Esh's reply also didn't work as IsGenericType returns false for this type.

Anyone any ideas how I deconstruct this type. Please let me know if you need any more info.





Aucun commentaire:

Enregistrer un commentaire