I have a struct that is essentially a Key Value Pair. I have another class that has multiple properties of these MyStruct (the key is a string and the value is T) or some other type. I want to get all of the properties and call their ToString function on the value, e.g.
foreach (var prop in AllTheProperties)
{
if (prop.GetType() is typeof(MyStruct<ignoreMe>)
{
yield return prop.Key;
yield return prop.Value.ToString();
}
}
But where I get stuck is on the typing part. I don't want to get all of the type strings, then type int, etc. How can I ignore the type? (on a side note, this will be ported to VB, but I prefer to do some things in c# first).
Aucun commentaire:
Enregistrer un commentaire