i got stuckup with my first C# program
-
hi, basically I am a VB/ASP developer, and I am poor in OOP's concepts. I just started learning C#, and when I am trying to execute my first C# program which i got in one book, after execution it is not returning any line to out put screen. plz help me in this. CODE:
using System; namespace Wrox.ProCSharp.Basics { class MyFirstCSharpClass { static void Main() { Console.WriteLine("This isn't at all like Java!"); Console.ReadLine(); return; } } }
nagarajuepuri -
hi, basically I am a VB/ASP developer, and I am poor in OOP's concepts. I just started learning C#, and when I am trying to execute my first C# program which i got in one book, after execution it is not returning any line to out put screen. plz help me in this. CODE:
using System; namespace Wrox.ProCSharp.Basics { class MyFirstCSharpClass { static void Main() { Console.WriteLine("This isn't at all like Java!"); Console.ReadLine(); return; } } }
nagarajuepuriCheck if you created a console application or a windows application. On project properties, check "Output Type", and set it to "Console Application". If you set it to "Windows Application", it will have no console and all your Console.WriteLine will be ignored. Yes, even I am blogging now!
-
Check if you created a console application or a windows application. On project properties, check "Output Type", and set it to "Console Application". If you set it to "Windows Application", it will have no console and all your Console.WriteLine will be ignored. Yes, even I am blogging now!
Thanks for you intrest... actually, i didn't get you exactly. I have written this code in a text file and saved it with .CS extension, then i have executed this "sample.cs" file through command line like.... "csc sample.cs" Here i am not at all creating any application nor project, i am executing all my code through command line only. thanking you in advance, nagarajuepuri
-
Thanks for you intrest... actually, i didn't get you exactly. I have written this code in a text file and saved it with .CS extension, then i have executed this "sample.cs" file through command line like.... "csc sample.cs" Here i am not at all creating any application nor project, i am executing all my code through command line only. thanking you in advance, nagarajuepuri
You've only compiled the program, you need to execute it. By default, the executable is placed in the same directory where you compiled it and is named after the source file you compiled. So go to the directory where you compiled and run sample.exe .You'll see the output. Regards Senthil
-
You've only compiled the program, you need to execute it. By default, the executable is placed in the same directory where you compiled it and is named after the source file you compiled. So go to the directory where you compiled and run sample.exe .You'll see the output. Regards Senthil
hi ... first of all u should add the path of the .Net framework to ur system variables (environment variables -> PATH). to create an exe file u should ask for this in the command u r using to compile the code sample ... to know the exact syntax of all options u can use with CSC , write "csc /?" (of coursr without the double qoutes). i hope this helps.
-
hi ... first of all u should add the path of the .Net framework to ur system variables (environment variables -> PATH). to create an exe file u should ask for this in the command u r using to compile the code sample ... to know the exact syntax of all options u can use with CSC , write "csc /?" (of coursr without the double qoutes). i hope this helps.
Thanks you all, I got the solution, once again thanks to you all. .exe file is created when i compiled the code, then when i executed that, i got the desired output of the program. but let me clear one thing, can't we get that output at the time of compilation it self??? thanks once again
-
Thanks you all, I got the solution, once again thanks to you all. .exe file is created when i compiled the code, then when i executed that, i got the desired output of the program. but let me clear one thing, can't we get that output at the time of compilation it self??? thanks once again
Only if you write a batch file to do the compile first, then execute the program. The command line compiler will not launch the finished .EXE for you. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome