Cs Cheat Sheet
Cs Cheat Sheet
Cs Cheat Sheet
decimal 128-bit precise decimal values with 28-29 significant digits Class MyClass
ToType
ToUInt16
ToUInt32
Class public class Dog {...} abstract Indicates that a class is intended only to be a base class of
Constructor (one public Dog (string Constructors can co-exist const Specifies that the value of the field or the local variable cannot
be modified
parameter) var) {...}
event Declares an event
Field public string name
Static Class public static class Must only have static extern Indicates that the method is implemented externally
Dog {...} members new Explicitly hides a member inherited from a base class
Static Member public static int = 1 override Provides a new implementation of a virtual member inherited
from a base class
Finalizer ~Dog () {...} Cannot have modifiers or
(destructor) parameters partial Defines partial classes, structs and methods throughout the
same assembly
Access Modifiers readonly Declares a field that can only be assigned values as part of
the declaration or in a constructor in the same class
public Accessible by any other code in the same assembly or
another assembly that references it sealed Specifies that a class cannot be inherited
private Only accessible by code in the same class or struct static Declares a member that belongs to the type itself instead of to
a specific object
protected Only accessible by code in the same class or struct, or in a
derived class unsafe Declares an unsafe context
internal Accessible by any code in the same assembly, but not from virtual Declares a method or an accessor whose implementation can
another assembly be changed by an overriding member in a derived class
protected Accessible by any code in the same assembly, or by any volatile Indicates that a field can be modified in the program by
internal derived class in another assembly something such as the operating system, the hardware, or a
concurrently executing thread
!= Not equal to
Arithmetic Operators
+ Add numbers
- Subtract numbers
* Multiply numbers
/ Divide numbers