Solved

C# Main () return string

Posted on 2007-04-09
2
1,500 Views
Last Modified: 2012-06-27
Can Main in C# return a String?  I'm trying to do that and changed it from static void to static string and i get the following error:
MainString.exe' does not contain a static 'Main' method suitable for an entry point      MainString

Any help would be greatly appreciated.

--Rob
0
Comment
Question by:rkellow
2 Comments
 
LVL 3

Accepted Solution

by:
JipFromParis earned 500 total points
ID: 18878865
No, you can't. The Main function result must be handled at the system level (Windows) and the system defines the entry function of a program as returning an integer. Returning anything else than an integer is impossible. FYI, when you define the Main function with a void return type, the program will actually return a 0 value.
0
 
LVL 4

Expert Comment

by:CBeach1980
ID: 18878881
Where do you need to return the string to since Main is the starting point for an application?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
This is about my first experience with programming Arduino.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question