I'm not quite sure what I'm attempting to do is called, so I'm struggling to find any clues from google.
I have a couple of methods with the same logic in them, the only thing that differs is the property they are using on an object.
class Foo
{
public int A(Bar bar)
{
return bar.A * 2;
}
public int B(Bar bar)
{
return bar.B * 2;
}
public int C(Bar bar)
{
return bar.C * 2;
}
}
class Bar
{
public int A;
public int B;
public int C;
}
Instead of the three separate methods in Foo
I want one, with a signature that looks more like
public int X(Bar bar, ??? x)
{
return bar.x * 2;
}
Is this possible?