Array
an の内容を aに追加することについてはよく見てきましたComboBox
が、その逆はありません。ComboBox
の内容を に追加して、Array
処理のために別のメソッドに送信したいと思います。
.Items.Count
のサイズを決定する を既に取得していArray
ますが、 内のアイテムを循環する方法がわかりませんComboBox
。
あなたの質問に対するあなたのコメントを見ることから、あなたはおそらくこれが欲しいでしょう:
var arr = ingredientComboBox.Items.Cast<Object>()
.Select(item => item.ToString()).ToArray();
string[] items = new string[currentComboBox.Items.Count];
for(int i = 0; i < currentComboBox.Items.Count; i++)
{
items[i] = currentComboBox.Items[i].ToString();
}