I’m Learning C# – Part 1

C# pronounced as See Sharp. A more powerful object oriented programming language than C++. The # symbol has 4 + (plus) in it to show its superiority to C++.

Applications written in C# make use of the .Net Framework. The .NET Framework consists of Common Language Runtime (CLR) and Frame work class library (FCL).

Variables – To store some data, we make use of variables. It will allocate some memory to store this data.It is possible to change the information that a variable holds during runtime. A variable name can start with an alphabet or an ‘_’. Try to make the name meaningful or descriptive. This is a good coding practice.

Variable Data types – We need to declare the type of data that our variable will store and how much memory need to be allocated to it.

Eg: We need to store the age of a person. We use the data type int.

int age;

; is used for terminating each line of code. Now we need to assign a value to our variable age. It can be done in 2 ways.

int age; age = 32;

or int age = 32;

The only thing to remember is that you need to declare the data type of a variable before you assign value to that variable. Other data types are float, bool, char, string, double – all of these are built-in data types.

There’s a data type called var for which you let the compiler decide the variables’ data type. var a = 2; means the compiler will assign the data type of integer to the variable a.

Constants – A variable whose value you do not want to change during the execution of a code is associated with the keyword const. eg: Const int year = 2017;

Download and install Visual Studio Community Edition to start coding. Choose default configuration. It would take a while to install 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s