String > Strange Error

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
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

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

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top