Products for USB Sensing and Control
It is currently Thu Sep 02, 2010 8:35 am

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: passing arrays in C#
PostPosted: Thu Feb 07, 2008 6:12 pm 
Offline

Joined: Thu Feb 07, 2008 5:43 pm
Posts: 1
How does one write code such that you can pass arrays to functions in C#? I want to know how I can pass an integer array of unknown lengh as an argument to a function.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 08, 2008 1:35 pm 
Offline

Joined: Fri Sep 22, 2006 10:31 am
Posts: 40
Location: MSP, MN, USA
int[] intArray = new int[] { 1, 2, 3, 4 };
EnumerateArray(intArray);

...

private void EnumerateArray(int[] intArray)
{
foreach (int Element in intArray)
{
Console.WriteLine(Element);
}
}

Is that what you are looking for?


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group