TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tilo Jung
1.7k
21
4.4k
index was out of array range
May 10 2019 12:39 PM
Hello, I have a problem with the args-array. when I compile the code below - I get the error: index was out of array range, so what am I doing wrong? Thank you.
code:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication1
{
class
Program
{
static
void
Main(
string
[] args)
{
int
i;
args[0] =
"Jurgen01"
;
args[1] =
"Jurgen02"
;
//pruefen ob beimProgrammaufruf eine oder mehrere
//Zeichenfolgen uebergebenworden sind
//array args der methode main
//error - index was out of array range
if
(args.Length > 0)
{
//die Zeichenfolge an der Konsole anzeigen
for
(i = 0; i < args.Length; i++)
Console.WriteLine(args[i]);
}
else
{
Console.WriteLine(
"Kein Uebergabestring"
);
}
Console.ReadLine();
}
}
}
Reply
Answers (
2
)
using Xml Files in c#
How to print Receipt Directly on thermal printer