473,388 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

String > Strange Error

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

Oct 9 '07 #1
1 1082
shapper wrote:
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.

--
Göran Andersson
_____
http://www.guffa.com
Oct 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob Murdoch | last post by:
I have a situation where I call a COM object from ASP that is supposed to create a file. On occasion, especially during development, the output of the COM function is an error string rather than...
8
by: IWP506 | last post by:
Hey, I've got some code here that puzzles me. I'm putting together a url based on user input. Should be pretty straightforward, but there's a problem. First, here's my code. --- ...
4
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
12
by: ABeck | last post by:
Hello List, I have ar more or less academical question. Can there arise runtime errors in a program, if the include of <string.h> has been forgotten? If all the arguments to the functions of...
4
by: z. f. | last post by:
Hi, I'm having an aspx page with a server form. i have a grid with a delete button and below the grid, another area with inputs for inserting new values and an "add" button for submiting the...
4
by: David Bargna | last post by:
Hi I have a problem, I have a string which needs to be converted to a byte array, then have the string representation of this array stored in an AD attribute. This string attribute then has to...
2
by: Jonathan Bowlas | last post by:
Hi listers, I've written this little script to generate some html but I cannot get it to convert to a string so I can perform a replace() on the &gt;, &lt; characters that get returned. from...
3
by: Daniel T. | last post by:
This is basically what I have now... class Foo { /* definition irrelevant */ }; istream& operator>>( istream& is, Foo& foo ); // could throw int main() { ifstream file( "file.txt" ); Foo...
3
by: shapper | last post by:
Hello, I have an Action where I define a ViewData property named Ad: public ActionResult GoogleAdSense(string client, int height, string slot, int width) { StringBuilder ad = new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.