0% found this document useful (0 votes)
4 views1 page

C# Language Basics and Syntax Guide

This document provides an introduction to C#, highlighting its object-oriented nature and syntax similarities with Java and C++. It covers variable declaration, naming rules, and array usage, including examples for clarity. Key points include case sensitivity, line termination with semi-colons, and comment styles.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

C# Language Basics and Syntax Guide

This document provides an introduction to C#, highlighting its object-oriented nature and syntax similarities with Java and C++. It covers variable declaration, naming rules, and array usage, including examples for clarity. Key points include case sensitivity, line termination with semi-colons, and comment styles.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LANGUAGE BASICS INTRODUCTION C# is a powerful Object Orientated language, for

those coming from Java or C++ you should be able to pick up the syntax for C# quickly. A
few points: The language is case-sensitive (So A and a are different) Lines terminate with
semi-colons Code is put in code blocks { } Inline comments start with // Block comments
start with /* */ XML comments start with /// VARIABLES To declare a variable you specify the
data type and variable name followed by a value. SYNTAX DataType variableName = value;
NAMING RULES Variables must start with underscore or letter Variables cannot contain
spaces variables can contain numbers Cannot contain symbols (accept underscore)
EXAMPLE string Name = "thecodingguys"; int Year = 2013; I will use these two variables
throughout. ARRAYS Arrays are similar to variables, but can hold more than one value.
SYNTAX DataType[ ] ArrayName = { Comma Separated Values } // Array of any size
DataType[] ArrayName = new DataType[3] {Command Separated Values } //Expects 3
values EXAMPLE string[] MyGamesOf2013 = {"GTAV", "Battlefield3"}; string[]
MyMoveisOf2013 = new string[3] {"The Amazing Spiderman", "The Expendables 2", "Rise of
the planet of the apes"};

You might also like