String > Strange Error

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have the following code line:
....
Return Array.Sort(categories.ToArray)
....

categories is a Generic.List(Of String)

I get the error "Expression does not produce a value". Why? What is
wrong in my code?

Thanks,
Miguel
 
shapper said:
Hello,

I have the following code line:
...
Return Array.Sort(categories.ToArray)
...

categories is a Generic.List(Of String)

I get the error "Expression does not produce a value". Why? What is
wrong in my code?

Thanks,
Miguel

There are two things wrong with your code.

1. You are using the ToArray method to create an array, but you doesn't
get a reference to the array. Once the array is sorted, you don't have
any reference to it so you can't reach it.

2. The Sort method doesn't return anything.
 
Back
Top