得到一个枚举我有这样的对象:无法从排序列表
class Animation
{
//[...]
private SortedList<int,Frame> frames = new SortedList<int,Frame>();
private IDictionaryEnumerator frameEnumerator = null;
//[...]
public void someFunction() {
frameEnumerator = frames.GetEnumerator(); //throw error
}
//[...]
}
我查MSN的文件有:http://msdn.microsoft.com/en-us/library/system.collections.sortedlist.getenumerator.aspx,它看起来像我的代码是正确的,但VS说:
不能将“System.Collections.Generic.IEnumerator>' 转换为'System.Collections.IDictionaryEnumerator'。
你为什么要获得一个枚举器,而不是通过'foreach'或类似的方法*使用*它? – 2013-03-01 23:18:42
这是因为我想获取当前元素。帧有temporisation,在一个指定的延迟之后,enumeotar将进入下一个。 – 2013-03-01 23:25:49