DOT NET BASICS

How to download C# Compiler:

  • No Need to download C# Compiler for Windows Operating System.
  • In built the .NET Framework has C# Compiler.
  • But another than windows platform we need to purchase a tool called "Visual Studio".
  • Even though sometimes the code may not compile for other operating systems, for that purpose we need to download "novo builder" software to make dotnet as platform independent.

Now we need to set a path for compiling and executing c sharp programs.
For that open command prompt

How to run a sample Hello world program:

Open notepad and write Hello World program and save with the extension of .cs .


Now run the same program in visual studio, it appears as

For compiling and executing the same program we need not to set any path for this and we simply press F5 for auto-compiling and running the program.
Then the output can be seen as,

Declaring Variables:



Loops and conditions:



If - else Condition:



Read input from keyboard and write to output screen:




Read data from file:





Write data to file:



  


Reading specific lines from file: 





Reading a string from a file and replace with the another string: 



Graphic output: Drawing a Triangle :





Drawing a Rectangle: 






Previous
« Prev Post