02-Syntax In C#

Syntax In C#

Syntax In C#  is a bit the same with Java depending on the syntax that derives from C and C++. C#  program is in need of powerful structure when it comes to its object-oriented nature in terms of classes. Wherein, the statement needs to be exact.

A statement is a basic implementation of C# Syntax program. This statement can be declared as variable, execute an event by calling a method, create a method and many more, and it ends with semicolon.

CSharplogo1 syntax


namespace myFirstCsharp
 public partial class Form1 : Form
 public Form1()
 //This method is for the designer support.
 //Reminder: do not modify the content of this method with the code editor.

 //creating a method
 private void HelloWorld()
 string msg;// declaring varible
 msg = "Hello world!"; //storing value in a variable
 MessageBox.Show(msg); //desplaying value of a variable
 private void button1_Click(object sender, EventArgs e)
 HelloWorld(); // calling a method





A statement between { } braces is the body of the method. These braces serve as the fence of the codes in the method.  This will help you identify what is the process or event you’re going to execute.


 private void Calculate()
 { //start of the method

 //variables are accessable any where inside the method.
 int input1 = 3;
 int input2 = 2;

 if (input1 > 2)
 //variable is accessable here only.
 int tot;
 tot = input1 - input2;

 }//end of the method

 private void button1_Click(object sender, EventArgs e)
 Calculate(); // calling a method




Project Name : Syntax
Project Platform :C#
Programming Language Used:C# Programming Language
Developer Name :itsourcecode.com
IDE Tool (Recommended):Visual Studio 2019
Project Type :Desktop Application
Upload Date and Time:June 11, 2016- 6:10 am

Leave a Comment