[英]cannot be serialized because it does not have a parameterless constructor
我知道錯誤在哪里,我已經在互聯網上尋找解決方案,但是似乎無法解決。
這是有問題的構造函數。
public SplashScreen(Image image)
{ // Create a constructor which requires the image as a variable;
this.Image = image;
}
為了使它成為無參數的構造函數,您需要刪除Image image
和this.Image = image;
。 如果需要,您可以添加這樣的構造函數,並保持該版本不變。
為了使用.Net標准序列化API序列化一個類,您需要具有一個無參數的構造函數。 所以我建議怎么做:
public SplashScreen()
{
}
public Image Image { get; set; }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.