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
Michael Cort
NA
6
3.8k
Passing uninitialized array as argument
Mar 21 2012 2:26 PM
I am trying to pass an array to a subroutine that will populate it. It doesn't like that the array is not initialized before passing it. I don't know how many elements the array will have as that is determined in the subroutine. How can I fix this?
Here is an example
private void x
{
......
string sTestFile = "this is a test";
string[] TestFileWords;
FixConcatString(sTestFile, TestFileWords);
}
private void FixConcatString(string splayfile, string[] sWordArray)
{
char[] charSeparators = new char[] { '-' };
splayfile = splayfile.ToLower();
splayfile = splayfile.Replace(@"\", " ");
sWordArray = splayfile.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
}
It gawks that I am passing TestFileWords to the subroutine without initializing it.
Reply
Answers (
3
)
How to Play Youtube Videos on button click?
Sold my tablet!