Sat80
asked on
add text file to int?
Hi Experts,
I have this int:
int[][] s =
{
new[] { 1, 4 },
new[] { 1, 3},
};
As you can see I have to specify the int elements, but I want to read a text file and add their lines as elements in that int. The text I have looks like this:
data.txt:
1,4
1,3
I would like to read the data.txt file and add their lines to ( int[][] s)?
Note: I am using C# 2008
Thanks for your help
Regards
Sat80
I have this int:
int[][] s =
{
new[] { 1, 4 },
new[] { 1, 3},
};
As you can see I have to specify the int elements, but I want to read a text file and add their lines as elements in that int. The text I have looks like this:
data.txt:
1,4
1,3
I would like to read the data.txt file and add their lines to ( int[][] s)?
Note: I am using C# 2008
Thanks for your help
Regards
Sat80
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just a note:
The asker wanted this type of an array:
int[][] s
Really, this is an array of arrays. For integers, BTW.
s_chilkury proposes to use two-dimensional String[,] array2D; (of strings!). It's a bit different..
And yes, I put some parsing in my code but didn't much care about error handling. really, I always use
int.TryParse method...instead of just Parse...
The asker wanted this type of an array:
int[][] s
Really, this is an array of arrays. For integers, BTW.
s_chilkury proposes to use two-dimensional String[,] array2D; (of strings!). It's a bit different..
And yes, I put some parsing in my code but didn't much care about error handling. really, I always use
int.TryParse method...instead of just Parse...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window