Skip to content

Instantly share code, notes, and snippets.

@ryanwebjackson
Created February 8, 2018 21:50
Show Gist options
  • Save ryanwebjackson/235b48d042c47c45d6a30973634728b1 to your computer and use it in GitHub Desktop.
Save ryanwebjackson/235b48d042c47c45d6a30973634728b1 to your computer and use it in GitHub Desktop.
I realize this *sounds* like a bad idea, but hear me out. I have a few different imported web services (.NET classes generated from a web service response definition), and classes from different services implicitly have the same interface - they have properties named that same, which represent the same things, but are only different types due to code generation. Is there a way to create an explicit interface to represent this relationship? I tried make a standard, typed C# interface, and it's not easy, due to custom classes several levels deep.
I realize I could use reflection, or serialize to JSON, but am wondering if there's a way I could use dynamic types, or something else, to say
"I want these (named) properties, but don't care what type they are".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment