namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
foreach (string item in SimpleList())
{
Console.WriteLine(item);
}
Console.ReadKey();
} public static IEnumerable SimpleList()
//错误 使用泛型 类型“System.Collections.Generic.IEnumerable<T>”需要“1”个类型参数
//请教如何解决这个问题?
{
yield return "string 1";
yield return "string 2";
yield return "string 3";
}
}}
{
class Program
{
static void Main(string[] args)
{
foreach (string item in SimpleList())
{
Console.WriteLine(item);
}
Console.ReadKey();
} public static IEnumerable SimpleList()
//错误 使用泛型 类型“System.Collections.Generic.IEnumerable<T>”需要“1”个类型参数
//请教如何解决这个问题?
{
yield return "string 1";
yield return "string 2";
yield return "string 3";
}
}}
解决方案 »
- SqlDataReader.HasRows属性不正常!!!!!!
- datatable里有列是时间类型怎么转换为string类型
- 如何修改web服务器下的txt文件
- 50分!由VB.NET(已有些基础)转学C#,请大大们帮忙推荐几本书!
- 菜鸟问两个问题(容器控件和TOOLTIP)?
- 关于picturebox 不要自动刷新的问题
- 怎么使得一个请求 t1_p1.html 处理的实际上是 content.asp?title=1&page=1
- WPF,请看下这个可视化层的命中测试
- 【求助】關於OleDbParameter的問題
- 微信卡卷有时候正常有时候刷新会报签名错误
- 请教一下,如何将个C语言程序变成一个dll文件引用
- vs2005 怎么样???
改为:
public static IEnumerable<string> SimpleList()
我还以为一定要实现GetEnumerator呢,刚才看了一下,果然是System.Collections引入了就可以了