Show Menu
Cheatography

C# Fundamentals Cheat Sheet (DRAFT) by

C# is a general-purpose, high-level multi-paradigm programming language. C# encompasses static typing, strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented, and component-oriented programming disciplines.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Types

int a = 5;
Integer
bool test = true;
Boolean
float temper­ature;
Initiation
int[] source = { 0, 1, 2, 3, 4, 5 };
Array declar­ation
Primitive types
Primitive data types are a set of basic data types from which all other data types are constr­ucted.
Value Type
A Value Type stores its contents in memory allocated on the stack.
Reference type
Reference Types are used by a reference which holds a reference (address) to the object but not the object itself
 

Namespaces

namespace MyName­space { 
class MyClass {
public void MyMethod() {
System.Co­nso­le.W­ri­teL­ine­("Cr­eating my namesp­ace­");
} } }
Defining Namespace in C#
Namesp­ace­-Na­me.M­em­ber­-Name
Accessing elements from other namespace
Namespaces are used in C# to organize and provide a level of separation of codes. They can be considered as a container which consists of other namesp­aces, classes, struct­ures, delegates etc.