Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. i got stuckup with my first C# program

i got stuckup with my first C# program

Scheduled Pinned Locked Moved C#
learningcsharpjavahelp
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nagarajuepuri
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • N 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; } } } nagarajuepuri

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      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!

      N 1 Reply Last reply
      0
      • D Daniel Turini

        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!

        N Offline
        N Offline
        nagarajuepuri
        wrote on last edited by
        #3

        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

        S 1 Reply Last reply
        0
        • N 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

          S Offline
          S Offline
          S Senthil Kumar
          wrote on last edited by
          #4

          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

          M 1 Reply Last reply
          0
          • S S Senthil Kumar

            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

            M Offline
            M Offline
            Mr Cooper
            wrote on last edited by
            #5

            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.

            N 1 Reply Last reply
            0
            • M Mr Cooper

              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.

              N Offline
              N Offline
              nagarajuepuri
              wrote on last edited by
              #6

              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

              D 1 Reply Last reply
              0
              • N nagarajuepuri

                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

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups