我新的ASP.NET &試圖創建一個對象,但有一個語法錯誤創建一組獲得類和傳遞參數的構造函數
public class pair
{
private string key;
private string value;
public pair(string key, string value)
{
this.key = this.setKey(key);
this.value = this.setValue(value);
}
private void setKey (string key) {
this.key = key;
}
public string getKey()
{
return this.key;
}
private void setValue(string value)
{
this.value = value;
}
public string getValue()
{
return this.value;
}
}
這兩條線
this.key = this.setKey(key);
this.value = this.setValue(value);
有有什麼不對,有誰知道這些問題?
問題固定... – hkguile
爲什麼你那麼問..?@ hkinterview –
你分配不具有返回值(空)的方法的返回值。您應該更多地關注編譯器的錯誤消息。 – VahidNaderi