?
Solved

C# Main () return string

Posted on 2007-04-09
2
Medium Priority
?
1,518 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

777 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