Understanding the Fundamentals of C# With a JS Background

Komal
The Startup
Published in
4 min readAug 6, 2020

--

https://miro.medium.com/fit/c/1838/551/1*uhSX5djhrWiguXoWsW_lEw.png

One of the common questions I always find myself asking an SWE is, “how do you know so many languages?” The response is always mixed with a joke or two. After spending time building full-stack applications using JavaScript with Ruby on Rails backend, I wanted to explore another backend framework that I am always seeing on job descriptions. .Net is a common framework that companies still use today. Until recently with JS and React, .net is normally connected with C#. So I wanted to dive deeper into the language and what difference/similarity does it have with JavaScript.

Print to the CMD

Let’s start with printing out an output to the CMD. In JavaScript, we can write our function and use console.log() to get our output. In C# we write Console.WriteLine(“Hello World”); to execute the output. However, C# will terminate the program once the line is executed. In order to keep the window up, we write another line of code: Console.ReadLine(); This will now leave the window open until you click Enter. This tells the program that we are done.

Please note: You need to include ‘;’ at the end of each line in C# so it can execute.

Variables

Javascript we know we need to declare any data type using ‘var’, ‘const’, and ‘let’. Today, we taught…

--

--