-3
如何將以下代碼從Java重寫爲C#?從Java代碼到C#
public List<IWebElement> findAll (By by)
{
return driver.FindElements(by);
}
如果我複製粘貼,我得到以下錯誤:
cannot implicitly convert type 'System.Collections.ObjectModel.ReadOnlyCollection<OpenQA.Selenium.IWebElement>' to 'System.Collections.Generic.List<OpenQA.Selenium.IWebElement>'
謝謝!
嗯......我建議使它簡單的IEnumerable''和保證命名空間'OpenQA.Selenium'位於'using'塊中。 「ToList」有點不必要,並且適得其反(即在需要使用它之前,不要將某些內容稱作內存)。 –
Arran
2015-03-02 11:40:35