不可调用成员“ListBox.Items”不能像方法一样使用

Non-invocable member 'ListBox.Items" cannot be used like a method

所以这段代码应该是正确的,因为它是从 VB 转换为 C# 并且它给了我这个错误。

         private void lstItems_DoubleClick(object sender, EventArgs e)
        {
        // validate item is selected
        int itemIndex = lstItems.SelectedIndex;

        // get price of selected item and add to order list
        lstOrder.Items.Add(lstItems.Items(itemIndex).ToString());
        decimal ThisPrice = listItemPrices[itemIndex];
        listOrderPrices.Add(ThisPrice);
        recalculateTotals();

        // get string value of selected item and add to order listbox


        // display totals from calculation performing functions
       }

我的错误在 lstOrder.Items.Add(lstItems.Items(itemIndex).ToString((); 我如何摆脱这个错误?

Visual Basic 在使用括号进行数组索引方面相当独特。转换为 C# 时,您忘记将其切换为标准方括号。 lstItems.Items(itemIndex) 应该是 lstItems.Items[itemIndex].