我已經耗盡。需要幫助什麼是字符串類型適當擴展方法「改爲」 ...... words.Text ==「藍色」產生錯誤C# - 擴展方法
string userInput = textBox1.Text;
string[] words = userInput.Split();
if (words.Text ==" blue ")
{
string color = words[2];
label1.Text = "The third word is: " + color;
}
else
{
label1.Text = "Not enough words.";
}
'字符串不是字符串類型 - 它是'字符串數組' – Fabio
'words'是一個字符串數組,它沒有'Text'屬性。你需要與包含'string'的單詞[index]進行比較。 –
此外,你似乎已經知道,因爲你稍後分配顏色... – Icepickle