M. Niyazi Alpay
M. Niyazi Alpay
M. Niyazi Alpay

I've been interested in computer systems since a very young age, and I've been programming since 2005. I have knowledge in PHP, MySQL, Python, MongoDB, and Linux.

 

about.me/Cryptograph

  • admin@niyazi.org
C# General Programming Logic

C# is a language that works through Net Frameworks. C# requires Microsoft Visual Studio to be installed on our computer in order to write applications. The necessary frameworks are installed on our computer with Visual Studio.

When we open a C# console application in Visual Studio, we encounter the following code:

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Cryptograph");
        }
    }
}

The code starting with using System and other using statements calls namespaces, meaning using System calls the System namespace, which allows us to use the code within the System namespace in our program. For example, when we want to print text to the screen:

Console.Write("Cryptograph");

we use this code. However, if we had not called the System namespace, our C# application would not recognize this command.
Now let's make a change in the code:

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Console.Write("Cryptograph");
        }
    }
} 

I did not call the System namespace, but when printing to the screen, I used System.Console.Write("Cryptograph");, I called the Console.Write command from within the System namespace this way. However, this usage is difficult, so it is best to call the namespace at the beginning.
Also, notice that commands are always terminated with a ; sign, which indicates the end of the command. If we want to use a different command without putting a ;, the program will give an error.

In conclusion; We need namespaces to write applications in C# and commands are terminated with a ; sign.

Author

Cryptograph

You may also want to read these

There are none comment

Leave a comment

Your email address will not be published. Required fields are marked *