Through the clever usage of the language anyone can have an application specifically tailored to their needs, some games are developed through the usage of C# as are many modern mobile applications, it is one of the most reliable languages at the moment and has cross-platform integration, this means one application for many devices. Creating a singular app that works on many devices not only allows you the consumer to save some money and time, but also allows you to be comfortable knowing that your company or application is available world wide, on many devices, many systems and possibly in many different languages.
One of the first projects most people undertake while learning to code, regardless of the lagnguage, is the famout "Hello World". This project is simple, covers how to explain via the language, how to display text to the users screen:
using System;
namespace HelloWorld
class Program {
static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
This set of code will use a variable to take in a form of user input and output it into a string format:
using System;
namespace UserInput
class Program {
static void Main(string[] args)
{
string userInput = "";
Console.ReadLine(userInput);
Console.WriteLine(userInput);
}
}
Variables are an integral part of coding, they define the data types which are in use, as well as a localised name for them which is used in reference throughout the code:
using System;
namespace UserInput
class Program {
static void Main(string[] args)
{
string String = "Hello";
int Integer = 1;
float Float = 3.14;
bool Boolean = true;
char Character = 'c';
Console.WriteLine(String);
Console.WriteLine(Integer);
Console.WriteLine(Float);
Console.WriteLine(Boolean);
Console.WriteLine(Character);
}
}
This piece of code will print out in order: Hello, 1, 3.14, true, c