在网上看到了使用IEnumerator来输出数组.提示错误.哪个朋友我讲讲.感谢!using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[,] arr = new string[2, 3];
arr[0,0] = "1,1";
arr[0,1] = "1,2";
arr[0,2] = "1,3";
arr[1,0] = "2,1";
arr[1,1] = "2,2";
arr[1,2] = "2,3";
// foreach (string arrStr in arr)
// {
// Console.WriteLine(arrStr);
// }
// Console.ReadKey(); IEnumerator ie = arr.GetEnumerator();
while (ie.MoveNext())
{
if (ie != null)
{
Console.WriteLine(ie.Current.ToString());
}
}
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[,] arr = new string[2, 3];
arr[0,0] = "1,1";
arr[0,1] = "1,2";
arr[0,2] = "1,3";
arr[1,0] = "2,1";
arr[1,1] = "2,2";
arr[1,2] = "2,3";
// foreach (string arrStr in arr)
// {
// Console.WriteLine(arrStr);
// }
// Console.ReadKey(); IEnumerator ie = arr.GetEnumerator();
while (ie.MoveNext())
{
if (ie != null)
{
Console.WriteLine(ie.Current.ToString());
}
}
Console.ReadKey();
}
}
}
解决方案 »
- 求解
- GridView中已有数据,但是有些数据为空,如何在这些空的地方插入一些字符
- 如何實現c++裡的 cout<<fixed<<setpresicion(2)<<good......
- 自定义控件的综合问题
- 如何获取鼠标ID号,或品牌号?能识别这一类型的鼠标就可以。请了解这方面的人给点意见,在线等。。。
- c# oleDB连接Excel03 和07版本不同的问题
- 基础连接已经关闭: 发送时发生错误。
- R1#AAA server is not reachable 请帮忙 Cisco Router 不能到达 Radius 服务器
- 微软WebBrowser COM组件应用高手进来看看
- 菜鸟问题:如何连向指定的WEB页?
- winform 选择颜色的下拉框
- 关于 socket 阻塞的 问题 !!!!!!!急,急,急!!!!!
using System.Collections;
using System.Collections.Generic;
using System.Text;
arr[0,1] = "1,2";
arr[0,2] = "1,3";
arr[1,0] = "2,1";
arr[1,1] = "2,2";
arr[1,2] = "2,3";赋值语句右边的逗号是什么意思?