What's an elegant solution to get the property values from two classes (that have the same property
- by SlipToFall
Essentially I have to deal with a poorly implemented web service. They have two classes that don't derive from a parent class, but have the same properties (Ughh...). So it looks like this in my web service proxy class file:
public partial class Product1
{
public int Quantity;
public int Price;
}
public partial class Product2
{
public int Quantity;
public int Price;
}
So what's the best way to grab the values from known properties without duplicating the code and casting to their respective classes? I know I probably could use reflection, but that can get ugly. If there is an easier less crazier way to do it (maybe in the new c# features?) please let me know.