我正在将一个类从 Windows 窗体应用程序导航到 Windows 商店应用程序。我从互联网上获得的课程如下所示,
public class ElementList : CollectionBase
{
/// <summary>
/// A Collection of Element Nodes
/// </summary>
public ElementList()
{
}
public void Add(Node e)
{
// can't add a empty node, so return immediately
// Some people tried dthis which caused an error
if (e == null)
return;
this.List.Add(e);
}
// Method implementation from the CollectionBase class
public void Remove(int index)
{
if (index > Count - 1 || index < 0)
{
// Handle the error that occurs if the valid page index is
// not supplied.
// This exception will be written to the calling function
throw new Exception("Index out of bounds");
}
List.RemoveAt(index);
}
public void Remove(Element e)
{
List.Remove(e);
}
public Element Item(int index)
{
return (Element) this.List[index];
}
}
在上述类中,商店应用程序不接受 CollectionBase。请告诉我一种将其导航到 Windows 8 商店应用程序的方法。. .
提前致谢!