Я пытаюсь сделать что-то вроде этого:
private List<ICards> selectedCards = new List<ICards>();
foreach (var card in selectedCards)
foreach (var item in card.GetType().GetProperties())
{
string save = XamlWriter.Save(item);
tw.WriteLine(item.GetValue(card, null));
}
tw.Close();
}
Где ICards это интерфейс
interface ICards
{
string CardType { get; set; }
string Name { get; set; }
int AddressIndex { get; set; }
}
И пример:
class CardBizonOc : ICards
{
public string CardType { get; set; }
public string Name { get; set; }
public int AddressIndex { get; set; }
public string Entry1 { get; set; }
public string Entry2 { get; set; }
}
На данный момент string save = XamlWriter.Save(item);
throw: You cannot serialize the type "System.Reflection.RuntimePropertyInfo".
Как мне вытащить объекты из card
, чтобы это сделать?