Hi,
You said each item has Decription property. so one way is to have an interface and each of your item, impelemtns that interface. some thing like this:
public interface ISameDescription
{
string Description {get;set;}
}
public class Weapon:ISameDescription
{
private String _description;
public Weapon (String description)
{
_description = description;
}
public Description{get{} set{}}
}
Now in your foreach statement you can have something like:
foreach(ISameDescription o in inventory)
{
}
if you don't wish to change your code, you can take advantage of invoke.
some thing like this:
foreach(object o in inventory)
{
o.GetType().InvokeMember("Description", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.Public, null, o, null);
}
hope this can help you.