Solved

C# Main () return string

Posted on 2007-04-09
2
1,474 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now