i have a method that looks like this:
private double GetX()
{
if (Servings.Count > 0)
{
return Servings[0].X;
}
if (!string.IsNullOrEmpty(Description))
{
FoodDescriptionParser parser = new FoodDescriptionParser();
return parser.Parse(Description).X;
}
return 0;
}
and i have another method that looks like this:
private double GetY()
{
if (Servings.Count > 0)
{
return Servings[0].Y;
}
if (!string.IsNullOrEmpty(Description))
{
FoodDescriptionParser parser = new FoodDescriptionParser();
return parser.Parse(Description).Y;
}
return 0;
}
Is there any way to consolidate this as the only thing different is the property names?