Applications of C#

Applications of C#

C# is used to build various types of applications like:

  1. Web applications and windows services
  2. Gaming applications
  3. Enterprise applications
  4. Web services and API
  5. Machine learning and artificial intelligence
  6. Internet of Things
  7. Backend Services
  8. Window libraries and client applications
  9. Android mobile apps
  10. Other software like Office, SQL, etc.

C# code example

 

Below is the simple C# code example to print a message:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FirstProgram
{
    class Program
    {
        static void Main(string[] args)  // Main Method
        {
            Console.WriteLine("This is C# Tutorial"); //Display message
            Console.ReadKey();
        }
    }
}
Explanation:

Using is for including the System namespace, which is basically a collection of classes.

The class consists of methods of the program. The above code consists of the main method, which shows the behavior of the class.

Static is the keyword that is used to tell whether this method is accessible or not without instantiating the class.

Main() method is where the execution starts. Having only one main method in a program that specifies the behavior is mandatory. It is basically an invoked method to execute.

WriteLine() is used to get output. We can write System.Console.WriteLine(), where System is a namespace with class Console, and WriteLine are the methods to display any message of a class.

ReadKey() is held on the screen until a key is pressed.

The output of the above code is:

When the above code is compiled and executed, it produces the following result:

C# code example

 

Prerequisites


It is good to have knowledge of the C language, which will help to understand the basic concepts and syntaxes.

Target audience


This is for beginners so that they can understand the basics of C# programming and its applications and advantages.