我嘗試序列化我的列表,字符串和錯誤「‘弦’不包含一個構造函數參數0」「字符串」不包含帶0參數的構造函數 - 爲什麼? :/
[Serializable]
class ComponentSerialization
{
public string komponent;
/**
* Konstruktor
*/
public ComponentSerialization(string v) {
ustawKomponent(v);
}
public void ustawKomponent(string v) {
this.komponent = v;
}
public string pobierzKomponent() {
string kom = new string();
kom = this.komponent;
return kom;
}
}
爲什麼不工作? :/
那麼,爲什麼是相當明顯的:'string'沒有構造函數需要0個參數,這就是爲什麼。 'new string()'基本上會創建一個空字符串,只需使用''「''或'String.Empty'。 – InBetween
應該有一個「如何閱讀和理解Stacktraces」...... – Fildor