Xml シリアライゼーションを行っていますが、コンパイル アイテム エラーが発生します。
エラーのあるコードは次のとおりです。
public class EPubBody
{
[XmlElement(ElementName = "Image", DataType = typeof(EPubImage))]
public object[] BodyItems;
}
エラーはそのtypeof(EPubImage)
部分にあります。エラーはCannot implicitly convert type 'System.Type' to 'string'
です。
クラスEPubImage
は同じ名前空間にあり、次のようになります。
public class EPubImage
{
[XmlAttribute("imagePath")]
public string ImagePath { get; set; }
}
の代わりにtypeof(EPubImage)
a を返していると思います。typeof ステートメントが System.Type ではなく文字列を返すようにする方法についての指針はありますか?System.Type
string