Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Hello world ! in C#

  1. public class HelloWorld
  2. {
  3. public static void Main()
  4. {
  5. System.Console.WriteLine("Hello, World!");
  6. }
  7. }


To avoid fully qualifying classes, we can use make use of ''using'' directive.

  1.  
  2. using system;
  3.  
  4. public class HelloWorld
  5. {
  6. public static void Main()
  7. {
  8. System.Console.WriteLine("Hello, World!");
  9. }
  10. }


As well as we can return the values from the method also.
Note: Main method is having Integer return type now.

  1.  
  2. using system;
  3.  
  4. public class HelloWorld
  5. {
  6. public static int Main(string[] args)
  7. {
  8. System.Console.WriteLine("Hello, World!");
  9. return 0;
  10. }
  11. }