vb.net - Error when assigning return value of ReadAllLines to variable -


i struggling function in visual studio:

private sub dlsuc()     dim file_ string = my.computer.filesystem.specialdirectories.temp & "\v.txt"     dim file string = io.file.readalllines(file_) end sub 

i can't work, these error messages:

error 1 value of type '1-dimensional array of string' cannot converted 'string'.

what reason this?

this because file.readalllines() returns array of strings. can read more here.

instead, try this:

private sub dlsuc()     dim file_ string = my.computer.filesystem.specialdirectories.temp & "\v.txt"     dim file string() = io.file.readalllines(file_) end sub 

notice () in variable declaration.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

post - imageshack API cURL -