❔ .Split function not visible for system
Function .Split invisible for system. Have anybody have the same problem?
21 Replies
and does anybody know how to solve it?
The error message is telling you.
this may be a case where using
var
is making it harder to understand what your code is doingstudent
is a char
, i.e. a single character and as such can't be split.but it is reading whole line from file
so how can it be char wait i will show all code
clearly
result
is a string
what do you expect when you write
foreach (var student in result)
?ReadAllTextAsync
gets the entire file as a string, not as string[]
(which would be ReadAllLines
string
@Kubiszon iterating over a string, no matter how long, will give you each individual character one after the other.
You need to split it some other way, but it's hart to say how without knowing the format of your input.
ye i mean at others people it is working hat the funniest thing leeme give you a printscreen
thats using
ReadAllLines
ooooh god
you are using
ReadAllText
damn thank u soo mutch haha
as @Jimmacle suggested, you probably want to get into the habit of using explicit types rather than var, so this doesn't happen (or less often at least).
thank u all for help
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.