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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top