我想删除WPF Canvas中的所有省略号。我用这个方法:
public void clearCircle()
{
var circles = cvsSurface.Children.OfType<Ellipse>().ToList();
foreach (var c in circles)
{
cvsSurface.Children.Remove(c);
}
}
但是,我在.OfType上收到错误:
'System.Windows.Controls.UIElementCollection' does not contain a definition for 'OfType' and no extension method 'OfType' accepting a first argument of type 'System.Windows.Controls.UIElementCollection' could be found.
我需要包含一些东西吗?我正在使用.NET 4.5