Csharp For Beginners (Introduction) - Gudio Tutorial

    Social Items


Csharp Introduction


Hello blogger, wherever you are, welcome back to this Blog Gudio. For those of you who are first time to this blog, Gudio Blog is a blog that discusses web, desktop and mobile programming, tips and tricks on blogs, android and others related to technology.

In this article, I will explain a little about All About Csharp For Beginners (Introduction), before I make an article about the Csharp Tutorial. So before that, at least we know what csharp is and how to use it.


What Is Csharp

Csharp or often abbreviated as C # is a programming language that can be used for general purposes. The point is that we can use this Csharp to create server-side programs on websites, create desktop or mobile-based applications, game programming and more. Or have you ever heard of Unity3D? Unity3D is a game engine that we can use to make 2D and 3D. Unity3D is already very well known among game makers or developers. And do you know, Unity3D, for coding in games using the Csharp code (C #).

Csharp is an object-oriented programming language developed by a worldwide company, Microsoft. I'm sure you already know about Microsoft, it's already famous for its Windows. The Csharp programming language is based on C ++ and there are also aspects in Java, Delphi. Visual Basic, and others that have been simplified.

And quoted from Wikipedia:
According to the ECMA-334 C # Language Specification standard, the name C # consists of a Latin letter C (U + 0043) followed by a fence sign that indicates the number # (U + 0023). The # sign used is not a sign of stress in the art of music (U + 266F), and the # sign (U + 0023) is used because the characters in the musical arts are not contained in the standard keyboard.

In the use of Csharp, it relies heavily on the .NET Framework. And this .NET Framework will be used to compile and run applications from this Csharp. Just like his brother, VB.Net, when you install an application that uses this Csharp programming language, you are required to install the .Net Framework first.

The purpose of building this programming language is as the main programming language in the .NET Framework environment. Many people say that Java with C # compete with each other, and there are also those who say if you have studied Java then learning C # will be very easy and so if you have learned C # it will be easy to learn Java. Is it really like that? The statement is actually not wrong because it needs to be known before C #, Microsoft developed J ++ with the intention of trying to make Java run on the Windows platform, because of external problems Microsoft stopped the J ++ project and switched to developing a new language, C#. For details, I will write in "History of Csharp" below.



History of Csharp

In the late 1990s, Microsoft created the Microsoft Visual J ++ program as an experiment to use Java on the Windows operating system to improve the interface of the Microsoft Component Object Model (As I said above). But due to copyright problems with the Java programming language, Sun Microsystems, Microsoft stopped the development of J ++, and switched to making its own replacement, compiler and virtual machine using a general-purpose programming language. To handle this manufacturing project, Microsoft hired Anders Helsberg. Anders Helsberg is a former Borland employee who made Turbo Pascal, and Borland Delphi languages. And as a result, C # was first introduced in July 2000 as an object-oriented modern programming language that became a major programming language in development on the Microsoft .NET Framework platform.

With the previous experience of Helsberg in designing programming languages ​​such as Delphi, Turbo Pascal, it was easily seen in the C # language syntax. The features taken from C ++ and Java are object oriented designs, and also simplification of multiple inheritance. These features in C # have now been applied to iterations, properties, events, metadata, and conversions between simple types and objects.

C # was developed to meet the need for a more concise C ++ syntax and 'unlimited application development' (compared to RAD on Delphi and Visual Basic).

In promoting Csharp (C #), Microsoft, with the support of Intel Corporation and Hewlett-Packard, tried to propose standardization of the C # language. And, in December 2001, the first standard was accepted by ECMA, with the standard number ECMA-334. In December 2002, the second standard was adopted by ECMA, and three months later it was accepted by the International Organization for Standardization (ISO), with the standard number ISO / IEC 23270: 2006


Integrated Development Environment for Csharp

In building and developing C #-based applications, we need an IDE (Integrated Development Environment) to help our work arrange program code. In Windows we can use Visual Studio which has very complete features. But not all of us use Windows for everyday needs on a computer and to install this IDE, the hard drive capacity on the computer must be adequate because it needs to know Visual Studio is very much consuming space on the Hard Drive. Therefore there is an alternative to Visual Studio called Xamarin Studio that can be used to create cross-platform applications which in my opinion are almost as great as Visual Studio and are very sufficient to build C # applications. Apart from that there are also tools like SharpDevelop, but it seems that it only works for Windows platforms. And for those of you who use a Operating System other than Windows, don't be sad, because you can use Mono to replace the .NET Framework.


Csharp Program Structure (C #)

In Csharp (#) programming or other programs it must have a code structure or code framework. For Csharp the following code structure:
  • Library, this library structure is a definition of the library that must be in the program or library that we import.
  • Namespace, this second structure is the name of the project that we created.
  • Class Name, this third structure is about what the name of the Class that we made and can also be directly marked as Main Class which indicates that the Class is the Main Class.
  • Method Declaration, this fourth structure is a declaration method as a prefix to run the method or command that is in it, if it is defined by "Main" then the method is first run by the compiler.
  • Method or Command, the fifth structure is the method or command that we provide for execution by the compiler.


Csharp Data Types

Data type is a type of data on Csharp that can be processed by a computer to meet the needs of computer programming. There are three data types in Csharp, as below:
  • Numeric Data Type
  • Boolean Data Type
  • Char Data Type

Numeric Data Type
A numeric type is a type used to handle problems such as numbers. Below is a data type that is included in the numeric type in Csharp.
Data Type Minimal Value Maximal Value
Sbyte -128 127
Byte 0 255
Short -32.767 32.767
Ushort 0 65.535
Int -2.147.483.648 2.147.483.647
Uint 0 4.294.967.295
Long -9.223.3742.036.854.775.808 9.223.3742.036.854.775.807
Ulong 0 18.446.774.073.709.551.615
Float 1,5 x 10-28 3,4 x 1038
Double 5,0 x 10-324 1,7 x 10308
Decimal 1,0 x 10-28 7,9 x 1028
The small number is superscript. Superscript is a character that is half above the normal line. Because the font type that I use on this blog does not support the superscript, so the character is not half above the normal line. So don't be confused and please forgive.

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int val1 = 20;
            double val2 = 2.7;
            Console.WriteLine("First Value = 20");
            Console.WriteLine("Second Value = 2.7");
            Console.WriteLine("==========================================");
            Console.WriteLine("First Value * Second Value");
            Console.WriteLine("Result = " + val1 * val2);
            Console.ReadLine();
        }
    }
}

Boolean Data Type
Boolean type
In each programming language, the boolean data type has two values, the first is true and the second is false. The boolean type in the Csharp programming language (C #) is known as bool.

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            bool condition1;
            bool condition2;

            int val1 = 20;
            int val2 = 22;

            condition1 = val1 > val2;
            condition2 = val1 < val2;

            Console.WriteLine("First Value = 20");
            Console.WriteLine("Second Value = 22");
            Console.WriteLine("==========================================");
            Console.WriteLine("First Condition : 20 > 22 = " + condition1);
            Console.WriteLine("Second Condition : 20 < 22 = " + condition2);
            Console.ReadLine();
        }
    }
}


Char & String Data Type
This type is a data type that is used to manipulate data in the form of a character or word.

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            string ket = "Gudio Blog : Char and String";

            Console.WriteLine("Tutorial Csharp Basic");
            Console.WriteLine("==========================================");
            Console.WriteLine("Hello, you are in ["+ket+"]");
            Console.ReadLine();
        }
    }
}


Operator Types In Csharp (C #)

In building a program or application whether it's web, desktop or mobile, we will definitely need an operator. This Csharp programming language has the following operators:

  1. Assignment operator
  2. Arithmetic Operators
  3. Conditional Operator
  4. Relational Operator

Assignment Operator
Variables must have values before they can read the values they have, but do not require variables to be initialized during declarations. Examples of writing variables are as follows:
Operator Information
= Simple operator, as a result of two values
+= Add AND assignment operators, this operator functions to add the right operand to the left operand and assign the result to the left operand
-= Substract AND assign operators, this function reduces the right operand of the left operand and sets the result to the left operand
*= Multiply AND assignment operator, this operator functions to multiply the right operand with the left operand and assign the result to the left operand
/= Divide AND assignment operator, this operator functions to divide the left operand with the right operand and assign the result to the left operand

Arithmetic Operators
This Arithmetic operator is useful for manipulating and managing numerical data variables with operators as follows:
Operator Information
+ Adds operands
- Subtracts operand
* Multiplies operands
/ Divides numerator by de-numerator
% Modulus Operator
The following below is an example program using the arithmetic operator :

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int val1 = 80;
            int val2 = 20;
            Console.Writeline("First Value : " + val1);
            Console.Writeline("Second Value : " + val2);
            Console.Writeline("============================================")
            int add = val1 + val2;
            int subs = val1 - val2;
            int mult = val1 * val2;
            double divd = Convert.ToDouble(val1) / Convert.ToDouble(val2);
            int modl = val1 % val2;

            Console.WriteLine("Adds operands : " + add);
            Console.WriteLine("Subtracts operand : " + subs);
            Console.WriteLine("Multiplies operands : " + mult);
            Console.WriteLine("Divides operands : " + divd);
            Console.WriteLine("Modulus Operator : " + modl);
            Console.ReadLine();
        }
    }
}


Conditional Operator
The condition operator that is used to manipulate logic data so as to produce a bool value. And here is a list of conditional operators:
Operator Information
&& Conditional operator AND
|| Conditional Operator OR
! NOT operator
& Logical AND operators
| Logis OR operator
^ Logical XOR operator

Relational Operator
This operator is to do a comparison between the two values to produce a bool value. Here's a list of relational operators:

Operator Information
> Check the value on the left operator is greater than the value on the right operator
< Check the value on the left operator is smaller than the right value of the operator
>= Check the value on the left operator whether it is greater or equal to the value on the right operator, if it is, then the result is true
<= Check the value on the left operator whether it is smaller or equal to the value on the right operator, if it is, then the result is true
== Check the two values are the same or not, if yes, then the result is true
!= Check whether the two values are the same or not, if not the same, then the result is true

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int val1 = 20;
            int val2 = 10;
            Console.WriteLine("First Value = 20");
            Console.WriteLine("Second Value = 10");
            Console.WriteLine("==========================================");
            bool condition1;
            bool condition2;
            bool condition3;
            bool condition4;
            bool condition5;
            bool condition6;

            condition1 =  val1 > val2;
            condition2 = val1 < val2;
            condition3 = val1 == val2;
            condition4 = val1 != val2;
            condition5 = val1 >= val2;
            condition6 = val1 <= val2;

            Console.WriteLine("val1 > val2 [20 > 10] is : " + condition1);
            Console.WriteLine("val1 < val2 [20 < 10] is : " + condition2);
            Console.WriteLine("val1 == val2 [20 == 10] is : " + condition3);
            Console.WriteLine("val1 != val2 [20 != 10] is : " + condition4);
            Console.WriteLine("val1 >= val2 [20 >= 10] is : " + condition5);
            Console.WriteLine("val1 <= val2 [20 <= 10] is : " + condition6);
            Console.ReadLine();
        }
    }
}


For more details, let's open the IDE. Here I use the Visual Studio 2015 IDE, you can customize the IDE I mentioned above, about IDEs that can be used for C # other than Visual Studio.



Make "Hello Word" Using IDE Csharp

This article is a theory about Csharp, for which I will make the tutorial. So in this article, I will practice how to display the word "Hello Word" with an IDE from Visual Studio. Follow the steps below:

  1. Open your Visual Studio (or another IDE that you use)
  2. Select Visual Csharp (C #).
  3. Create a New File (Please select your C # template. You can use the console, Windows application or the web. In this tutorial I will make it on the console)


The IDE will appear as shown below:

And add a line of code to display the message as below:

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Word. Thank You For Visit Gudio Blog");
            Console.Readline();
        }
    }
}

Below is a library that you can add later, depending on what application you make.

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


Below is a namespace for your project.

namespace ConsoleApplication1


And below this is the class of the project created.

 class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Word. Thank You For Visit Gudio Blog");
        }
    }
}


All code in C # must be in the class and each class consists of data and methods. Methods and data are also referred to as Class members. Data in classes is manipulated through methods. data is also called member variable or instance variable. instance variables declared outside the method. Quite clear?

And below is the method. here contains things that must be done by the compiler. In this example I will display the "Hello Word" message.

Console.WriteLine("Hello Word. Thank You For Visit Gudio Blog");



Conclusion

how, do you already know the basics of programming on Csharp? If you follow my article from beginning to end, you should be able to create a simple console application in Csharp (C#).

Hopefully this article about "All About Csharp For Beginners (Introduction)" can be useful for you. And if there are errors in writing this article, I, as the author, apologize. And if this article is useful for you, please share this article with your social media and don't forget to follow me on social media to get the latest information.

We meet again at other times and with other interesting articles.

Regards,
Gudio Blog

Csharp For Beginners (Introduction)


Csharp Introduction


Hello blogger, wherever you are, welcome back to this Blog Gudio. For those of you who are first time to this blog, Gudio Blog is a blog that discusses web, desktop and mobile programming, tips and tricks on blogs, android and others related to technology.

In this article, I will explain a little about All About Csharp For Beginners (Introduction), before I make an article about the Csharp Tutorial. So before that, at least we know what csharp is and how to use it.


What Is Csharp

Csharp or often abbreviated as C # is a programming language that can be used for general purposes. The point is that we can use this Csharp to create server-side programs on websites, create desktop or mobile-based applications, game programming and more. Or have you ever heard of Unity3D? Unity3D is a game engine that we can use to make 2D and 3D. Unity3D is already very well known among game makers or developers. And do you know, Unity3D, for coding in games using the Csharp code (C #).

Csharp is an object-oriented programming language developed by a worldwide company, Microsoft. I'm sure you already know about Microsoft, it's already famous for its Windows. The Csharp programming language is based on C ++ and there are also aspects in Java, Delphi. Visual Basic, and others that have been simplified.

And quoted from Wikipedia:
According to the ECMA-334 C # Language Specification standard, the name C # consists of a Latin letter C (U + 0043) followed by a fence sign that indicates the number # (U + 0023). The # sign used is not a sign of stress in the art of music (U + 266F), and the # sign (U + 0023) is used because the characters in the musical arts are not contained in the standard keyboard.

In the use of Csharp, it relies heavily on the .NET Framework. And this .NET Framework will be used to compile and run applications from this Csharp. Just like his brother, VB.Net, when you install an application that uses this Csharp programming language, you are required to install the .Net Framework first.

The purpose of building this programming language is as the main programming language in the .NET Framework environment. Many people say that Java with C # compete with each other, and there are also those who say if you have studied Java then learning C # will be very easy and so if you have learned C # it will be easy to learn Java. Is it really like that? The statement is actually not wrong because it needs to be known before C #, Microsoft developed J ++ with the intention of trying to make Java run on the Windows platform, because of external problems Microsoft stopped the J ++ project and switched to developing a new language, C#. For details, I will write in "History of Csharp" below.



History of Csharp

In the late 1990s, Microsoft created the Microsoft Visual J ++ program as an experiment to use Java on the Windows operating system to improve the interface of the Microsoft Component Object Model (As I said above). But due to copyright problems with the Java programming language, Sun Microsystems, Microsoft stopped the development of J ++, and switched to making its own replacement, compiler and virtual machine using a general-purpose programming language. To handle this manufacturing project, Microsoft hired Anders Helsberg. Anders Helsberg is a former Borland employee who made Turbo Pascal, and Borland Delphi languages. And as a result, C # was first introduced in July 2000 as an object-oriented modern programming language that became a major programming language in development on the Microsoft .NET Framework platform.

With the previous experience of Helsberg in designing programming languages ​​such as Delphi, Turbo Pascal, it was easily seen in the C # language syntax. The features taken from C ++ and Java are object oriented designs, and also simplification of multiple inheritance. These features in C # have now been applied to iterations, properties, events, metadata, and conversions between simple types and objects.

C # was developed to meet the need for a more concise C ++ syntax and 'unlimited application development' (compared to RAD on Delphi and Visual Basic).

In promoting Csharp (C #), Microsoft, with the support of Intel Corporation and Hewlett-Packard, tried to propose standardization of the C # language. And, in December 2001, the first standard was accepted by ECMA, with the standard number ECMA-334. In December 2002, the second standard was adopted by ECMA, and three months later it was accepted by the International Organization for Standardization (ISO), with the standard number ISO / IEC 23270: 2006


Integrated Development Environment for Csharp

In building and developing C #-based applications, we need an IDE (Integrated Development Environment) to help our work arrange program code. In Windows we can use Visual Studio which has very complete features. But not all of us use Windows for everyday needs on a computer and to install this IDE, the hard drive capacity on the computer must be adequate because it needs to know Visual Studio is very much consuming space on the Hard Drive. Therefore there is an alternative to Visual Studio called Xamarin Studio that can be used to create cross-platform applications which in my opinion are almost as great as Visual Studio and are very sufficient to build C # applications. Apart from that there are also tools like SharpDevelop, but it seems that it only works for Windows platforms. And for those of you who use a Operating System other than Windows, don't be sad, because you can use Mono to replace the .NET Framework.


Csharp Program Structure (C #)

In Csharp (#) programming or other programs it must have a code structure or code framework. For Csharp the following code structure:
  • Library, this library structure is a definition of the library that must be in the program or library that we import.
  • Namespace, this second structure is the name of the project that we created.
  • Class Name, this third structure is about what the name of the Class that we made and can also be directly marked as Main Class which indicates that the Class is the Main Class.
  • Method Declaration, this fourth structure is a declaration method as a prefix to run the method or command that is in it, if it is defined by "Main" then the method is first run by the compiler.
  • Method or Command, the fifth structure is the method or command that we provide for execution by the compiler.


Csharp Data Types

Data type is a type of data on Csharp that can be processed by a computer to meet the needs of computer programming. There are three data types in Csharp, as below:
  • Numeric Data Type
  • Boolean Data Type
  • Char Data Type

Numeric Data Type
A numeric type is a type used to handle problems such as numbers. Below is a data type that is included in the numeric type in Csharp.
Data Type Minimal Value Maximal Value
Sbyte -128 127
Byte 0 255
Short -32.767 32.767
Ushort 0 65.535
Int -2.147.483.648 2.147.483.647
Uint 0 4.294.967.295
Long -9.223.3742.036.854.775.808 9.223.3742.036.854.775.807
Ulong 0 18.446.774.073.709.551.615
Float 1,5 x 10-28 3,4 x 1038
Double 5,0 x 10-324 1,7 x 10308
Decimal 1,0 x 10-28 7,9 x 1028
The small number is superscript. Superscript is a character that is half above the normal line. Because the font type that I use on this blog does not support the superscript, so the character is not half above the normal line. So don't be confused and please forgive.

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int val1 = 20;
            double val2 = 2.7;
            Console.WriteLine("First Value = 20");
            Console.WriteLine("Second Value = 2.7");
            Console.WriteLine("==========================================");
            Console.WriteLine("First Value * Second Value");
            Console.WriteLine("Result = " + val1 * val2);
            Console.ReadLine();
        }
    }
}

Boolean Data Type
Boolean type
In each programming language, the boolean data type has two values, the first is true and the second is false. The boolean type in the Csharp programming language (C #) is known as bool.

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            bool condition1;
            bool condition2;

            int val1 = 20;
            int val2 = 22;

            condition1 = val1 > val2;
            condition2 = val1 < val2;

            Console.WriteLine("First Value = 20");
            Console.WriteLine("Second Value = 22");
            Console.WriteLine("==========================================");
            Console.WriteLine("First Condition : 20 > 22 = " + condition1);
            Console.WriteLine("Second Condition : 20 < 22 = " + condition2);
            Console.ReadLine();
        }
    }
}


Char & String Data Type
This type is a data type that is used to manipulate data in the form of a character or word.

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            string ket = "Gudio Blog : Char and String";

            Console.WriteLine("Tutorial Csharp Basic");
            Console.WriteLine("==========================================");
            Console.WriteLine("Hello, you are in ["+ket+"]");
            Console.ReadLine();
        }
    }
}


Operator Types In Csharp (C #)

In building a program or application whether it's web, desktop or mobile, we will definitely need an operator. This Csharp programming language has the following operators:

  1. Assignment operator
  2. Arithmetic Operators
  3. Conditional Operator
  4. Relational Operator

Assignment Operator
Variables must have values before they can read the values they have, but do not require variables to be initialized during declarations. Examples of writing variables are as follows:
Operator Information
= Simple operator, as a result of two values
+= Add AND assignment operators, this operator functions to add the right operand to the left operand and assign the result to the left operand
-= Substract AND assign operators, this function reduces the right operand of the left operand and sets the result to the left operand
*= Multiply AND assignment operator, this operator functions to multiply the right operand with the left operand and assign the result to the left operand
/= Divide AND assignment operator, this operator functions to divide the left operand with the right operand and assign the result to the left operand

Arithmetic Operators
This Arithmetic operator is useful for manipulating and managing numerical data variables with operators as follows:
Operator Information
+ Adds operands
- Subtracts operand
* Multiplies operands
/ Divides numerator by de-numerator
% Modulus Operator
The following below is an example program using the arithmetic operator :

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int val1 = 80;
            int val2 = 20;
            Console.Writeline("First Value : " + val1);
            Console.Writeline("Second Value : " + val2);
            Console.Writeline("============================================")
            int add = val1 + val2;
            int subs = val1 - val2;
            int mult = val1 * val2;
            double divd = Convert.ToDouble(val1) / Convert.ToDouble(val2);
            int modl = val1 % val2;

            Console.WriteLine("Adds operands : " + add);
            Console.WriteLine("Subtracts operand : " + subs);
            Console.WriteLine("Multiplies operands : " + mult);
            Console.WriteLine("Divides operands : " + divd);
            Console.WriteLine("Modulus Operator : " + modl);
            Console.ReadLine();
        }
    }
}


Conditional Operator
The condition operator that is used to manipulate logic data so as to produce a bool value. And here is a list of conditional operators:
Operator Information
&& Conditional operator AND
|| Conditional Operator OR
! NOT operator
& Logical AND operators
| Logis OR operator
^ Logical XOR operator

Relational Operator
This operator is to do a comparison between the two values to produce a bool value. Here's a list of relational operators:

Operator Information
> Check the value on the left operator is greater than the value on the right operator
< Check the value on the left operator is smaller than the right value of the operator
>= Check the value on the left operator whether it is greater or equal to the value on the right operator, if it is, then the result is true
<= Check the value on the left operator whether it is smaller or equal to the value on the right operator, if it is, then the result is true
== Check the two values are the same or not, if yes, then the result is true
!= Check whether the two values are the same or not, if not the same, then the result is true

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

namespace ConsoleApplication1
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int val1 = 20;
            int val2 = 10;
            Console.WriteLine("First Value = 20");
            Console.WriteLine("Second Value = 10");
            Console.WriteLine("==========================================");
            bool condition1;
            bool condition2;
            bool condition3;
            bool condition4;
            bool condition5;
            bool condition6;

            condition1 =  val1 > val2;
            condition2 = val1 < val2;
            condition3 = val1 == val2;
            condition4 = val1 != val2;
            condition5 = val1 >= val2;
            condition6 = val1 <= val2;

            Console.WriteLine("val1 > val2 [20 > 10] is : " + condition1);
            Console.WriteLine("val1 < val2 [20 < 10] is : " + condition2);
            Console.WriteLine("val1 == val2 [20 == 10] is : " + condition3);
            Console.WriteLine("val1 != val2 [20 != 10] is : " + condition4);
            Console.WriteLine("val1 >= val2 [20 >= 10] is : " + condition5);
            Console.WriteLine("val1 <= val2 [20 <= 10] is : " + condition6);
            Console.ReadLine();
        }
    }
}


For more details, let's open the IDE. Here I use the Visual Studio 2015 IDE, you can customize the IDE I mentioned above, about IDEs that can be used for C # other than Visual Studio.



Make "Hello Word" Using IDE Csharp

This article is a theory about Csharp, for which I will make the tutorial. So in this article, I will practice how to display the word "Hello Word" with an IDE from Visual Studio. Follow the steps below:

  1. Open your Visual Studio (or another IDE that you use)
  2. Select Visual Csharp (C #).
  3. Create a New File (Please select your C # template. You can use the console, Windows application or the web. In this tutorial I will make it on the console)


The IDE will appear as shown below:

And add a line of code to display the message as below:

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Word. Thank You For Visit Gudio Blog");
            Console.Readline();
        }
    }
}

Below is a library that you can add later, depending on what application you make.

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


Below is a namespace for your project.

namespace ConsoleApplication1


And below this is the class of the project created.

 class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Word. Thank You For Visit Gudio Blog");
        }
    }
}


All code in C # must be in the class and each class consists of data and methods. Methods and data are also referred to as Class members. Data in classes is manipulated through methods. data is also called member variable or instance variable. instance variables declared outside the method. Quite clear?

And below is the method. here contains things that must be done by the compiler. In this example I will display the "Hello Word" message.

Console.WriteLine("Hello Word. Thank You For Visit Gudio Blog");



Conclusion

how, do you already know the basics of programming on Csharp? If you follow my article from beginning to end, you should be able to create a simple console application in Csharp (C#).

Hopefully this article about "All About Csharp For Beginners (Introduction)" can be useful for you. And if there are errors in writing this article, I, as the author, apologize. And if this article is useful for you, please share this article with your social media and don't forget to follow me on social media to get the latest information.

We meet again at other times and with other interesting articles.

Regards,
Gudio Blog
iklan related post
Load comments