菜鸟提问,,,2,,,马上揭贴

lmf2008 2003-04-11 06:06:00
using System;

public class garbage
{
public static void print( params object[] args)
{
int ctr=0;
for ( ctr=0; ctr <= args.Length; ctr++)
{
Console.WriteLine("Argment{0}is:{1}",ctr,args[ctr]);
}
}
}

class MyApp
{
public static void Main()
{
long ALong =123445678567L;
decimal ADec=1234.54M;
byte Abyte=42;
string AString ="Cole McCrary";

Console.WriteLine("First Call.....");
garbage.print(1);
Console.WriteLine("Second Call.....");
garbage.print(123);
Console.WriteLine("\n\n Third Call...");
garbage.print( ALong,ADec,Abyte,AString);

Console.WriteLine("\n\nForth Call....");
garbage.print("binglan","what ","are","jjjjj","name","nide mignI");

}
}


这个小程序,在执行的时候,这句
Console.WriteLine("Argment{0}is:{1}",ctr,args[ctr]);老是有问题,说
Additional information: Index was outside the bounds of the array.

在线等待
...全文
19 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
DavidBone 2003-04-14
  • 打赏
  • 举报
回复
ding
abkn1 2003-04-11
  • 打赏
  • 举报
回复
for ( ctr=0; ctr <args.Length; ctr++)
abkn1 2003-04-11
  • 打赏
  • 举报
回复
数组越界?
lmf2008 2003-04-11
  • 打赏
  • 举报
回复
问题,已经解决,送分~~~

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧