C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: Reading an array from console Posted by loopmax on 31 Jan 2007 at 6:22 PM
: I want to make a console application that reads a 2d array,
: i tried to use Console.Read but it doesn't work.
: Help me.
: simion314
:

Why don't you use a ArrayList, it is a 2d array. then foreach the arraylist.

this is what you asked:

using System;
namespace ArraysSamp
{
class Class1
{
static void Main(string[] args)
{
string[,] names = new string[,]
{
{"Rosy","Amy"},
{"Peter","Albert"}
};
foreach( string str in names)
{
Console.WriteLine(str);
}
}

}}

Thread Tree
simion314 Reading an array from console on 29 Jan 2007 at 6:50 PM
loopmax Re: Reading an array from console on 31 Jan 2007 at 6:22 PM
simion314 Re: Reading an array from console on 31 Jan 2007 at 6:40 PM
loopmax Re: Reading an array from console on 31 Jan 2007 at 6:54 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.