Can we execute a program in c# without using any class ?
-
Saturday, April 07, 2012 1:24 PMtell me.
- Edited by TEJ2911 Saturday, April 07, 2012 1:26 PM
All Replies
-
Saturday, April 07, 2012 4:23 PM
You need at least the one class for a program to run. Creating a new project will automatically create the class for you . If you have older code, create a new project and drop the old code into the new project. A console application wil automatically generate a main function. Take you old main function code an paste it into the new main function. If you have any additioanl functions just place the code after the main function keeping the code inside the same class as main.
jdweng
- Proposed As Answer by Mike FengMicrosoft Contingent Staff, Moderator Monday, April 09, 2012 8:10 AM
- Marked As Answer by Mike FengMicrosoft Contingent Staff, Moderator Saturday, April 21, 2012 6:45 AM
-
Saturday, April 07, 2012 5:42 PM
No you cannot execute it. C# at least need one system defined or user defined class. That is what an objects oriented programming language should be.
I am bit curious to know what you want to achieve.
Lingaraj Mishra
- Proposed As Answer by Mike FengMicrosoft Contingent Staff, Moderator Monday, April 09, 2012 8:10 AM
- Marked As Answer by Mike FengMicrosoft Contingent Staff, Moderator Saturday, April 21, 2012 6:45 AM
-
Sunday, April 08, 2012 7:04 AM
Hi Tej2911,
do you mean you don't required .net framework to run your program ?
then you have to you use c++ to create your Project.
Regards
Purvi
- Proposed As Answer by Mike FengMicrosoft Contingent Staff, Moderator Monday, April 09, 2012 8:10 AM
- Marked As Answer by Mike FengMicrosoft Contingent Staff, Moderator Saturday, April 21, 2012 6:45 AM

