Programming in .NET with C#

 For Microsoft C# (C sharp) is the language of choice for development on the platform. NET and as we shall soon see the solution to the use of Java. The birth of the platform .NET is the fruit of Microsoft’s alternative to Sun’s Java language, in fact, remember all the disputes between these two giants of the software on this language and the changes that Redmond had made to J++. Programming languages can be compiled or interpreted, an example of the former is the C/C++, while an example of the latter is the Basic, Java was the forerunner of the so-called language semi-completed and more specifically compiled in bytecode, the non- completed is interpreted by the JVM (Java Virtual Machine), thus having a virtual machine for each operating system, Java lets programs run on virtually all systems with a JVM. The .NET is Microsoft’s answer to Java and it collects all its fundamental features, of course, something changes, but only at the level of detail, the basic idea is similar. This course will consist of C# on various lessons that I believe will be weekly, between classes and one I highly recommend to experiment, curiosity must be always on, otherwise it makes little headway, partly because the theory is easily forgotten. For practice, you can download the Express version of Visual Studio 2010 (C#), which is free can also be used to develop professional software. The C# is a language very powerful, because it is halfway to the complexity of C++ and the ease of VB.NET, after you learn this language to switch to C++ will be less traumatic than a jump from Basic to C, and then move on to VB is almost a walk. But see the basics of the language.
The C# is case sensitive, ie differentiates between uppercase and lowercase letters, then a variable called “X” will be different from “x”. As in C code blocks are delimited by braces. Each instruction, with the exception of cycles and blocks of code must be terminated by a semicolon, as in C. The comments are inserted as in C/C++ and Java:

/ / This is a comment on one line
/ * This is rather a comment on the most
lines, and this terminology should be used * /

We can now create your first project, the classic Hello World in the console. Open Visual C# Express File menu and create a new project, choose the console and enter the project title, I will insert “Course”.

using System;
public class Course
{
static void Main (string [] args)
     {
            Console.WriteLine ("Hello World");
            Console.ReadLine ();
     }
} 

The indentation is very important and also started to use these simple exercises. The first line is used to include the functions of the console and system, and defines the main class (we’ll talk about classes later in the lessons), a static function main (Main) which is the input function of the program (args are the arguments command-line and we will see them later this year). The function WriteLine Console is used to write a string (the text is in planning), while the ReadLine need to get a string from console input and in this case I inserted to stop the program and view the output on the screen, Press any button on the program ends, is because the program always has a beginning (the main function) and an end and go top to bottom.
The next lesson will focus on the control structures of language and always new examples of code.

This entry was posted in C# (sharp). Bookmark the permalink.