|
-
Apr 22nd, 2004, 10:20 AM
#1
Thread Starter
Fanatic Member
Return Array
Hi all,
THis is a very simple question, and I am just not getting something. How do you return an array from a function in C#. Here is my code:
Code:
private string[] readXML()
{
//do something
}
//here is where I call it
String[] ServerAndDB;
//it breaks on this line saying 'indentifier expected'
ServerAndDB[] = readXML();
Any thoughts?
-
Apr 23rd, 2004, 09:24 AM
#2
Re: Return Array
Originally posted by brianh
Hi all,
THis is a very simple question, and I am just not getting something. How do you return an array from a function in C#. Here is my code:
Code:
private string[] readXML()
{
//do something
}
//here is where I call it
String[] ServerAndDB;
//it breaks on this line saying 'indentifier expected'
ServerAndDB = readXML();
Any thoughts?
Get rid of the square brackets on the last line. Your function looks OK to me, its just the line you are calling it from. You don't use the square brackets unless you are accessing one of the elements inside the array.
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|