| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 561 人关注过本帖
标题:新手上路,看以下错误怎么解决
只看楼主 加入收藏
Time_Net
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-2-13
收藏
 问题点数:0 回复次数:0 
新手上路,看以下错误怎么解决

public class Stack<T> : IEnumerable<T>
{
public void Push(T item)
{
if (items == null)
{
items = new T[4];
}
else if (items.Length == count)
{
T[] newItems = new T[count * 2];
Array.Copy(items, 0, newItems, 0, count);
items = newItems;
}
items[count++] = item;

}
public T Pop()
{
T result = items[--count];
//items[count] =T.default;
return result;


}
public IEnumerator<T> GetEnumerator()
{
for(int i = count - 1; i >= 0; --i)
{
yield return items[i];
}
}

//public Stack()
//{
// items = new T[10];
// count = 0;
//}

public T[] items;
public int count=0;

}

提示错误:

Error 1 'WindowsApplication2.Stack<T>' does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'. 'WindowsApplication2.Stack<T>.GetEnumerator()' is either static, not public, or has the wrong return type. E:\WebSites\WindowsApplication2\WindowsApplication2\Form1.cs 126 18 WindowsApplication2

搜索更多相关主题的帖子: 新手上路 public null 
2006-02-13 13:41
快速回复:新手上路,看以下错误怎么解决
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011349 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved