Solved

C# Main () return string

Posted on 2007-04-09
2
1,512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Progress

724 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