modification

- Modified files
This commit is contained in:
Adefolarin Adeniji 2021-08-28 12:33:43 +01:00
parent a15e48a03e
commit 5e30e45736
2 changed files with 12 additions and 3 deletions

View File

@ -9,5 +9,10 @@ namespace GildedRoseKata
{
this.Items = Items;
}
public static object GetPropValue(object src, string propName)
{
return src.GetType().GetProperty(propName).GetValue(src, null);
}
}
}

View File

@ -55,7 +55,7 @@ namespace GildedRoseKata
// Get the type contained
Type type = t.GetType();
var instance = Activator.CreateInstance(type);
dynamic instance = Activator.CreateInstance(type) as Item;
// Get a property on the type that is stored in the
// property string
@ -78,6 +78,10 @@ namespace GildedRoseKata
updateQualityMethod.Invoke(instance, new object[0]);
updateSellinMethod.Invoke(instance, new object[0]);
// update t
t.SellIn = instance.SellIn;
t.Quality = instance.Quality;
Console.WriteLine("");
}