Logo

Codcups

Complete C# Reference's

Intro Of C# Language?

C# (pronounced "C-Sharp") is a modern, object-oriented, type-safe programming language developed by Microsoft as part of its .NET initiative. It's widely used for developing desktop applications, web applications, games (using Unity), cloud-based software, and more.

C# Language Full Reference Table

1. C# Keywords

KeywordDescription
abstractIndicates an incomplete implementation that must be overridden
asPerforms conversions between compatible types
baseAccess base class members
boolBoolean type (true/false)
breakExits the loop or switch
byte8-bit unsigned integer
caseDefines a switch case
catchHandles exceptions
char16-bit Unicode character
classDefines a class
constDefines a constant field or local
continueSkips the current loop iteration
decimalHigh-precision decimal type
defaultDefault value in switch or generics
delegateDefines a delegate type
doStarts a do-while loop
doubleDouble-precision floating point
elseDefines else branch
enumDefines an enumeration
eventDeclares an event
explicitDeclares a user-defined explicit conversion
externDeclares external method implementation
falseBoolean literal
finallyExecutes after try/catch block
fixedFixes a variable address in memory
floatSingle-precision floating point
forStarts a for loop
foreachIterates over a collection
gotoTransfers control to a label
ifConditional statement
implicitDefines implicit type conversion
inSpecifies input parameter
int32-bit signed integer
interfaceDeclares an interface
internalAccessible only within the assembly
isChecks object type at runtime
lockEnsures thread safety
long64-bit signed integer
namespaceDeclares a scope container
newCreates object or hides member
nullRepresents no value
objectBase type of all types
operatorOverloads an operator
outSpecifies output parameter
overrideOverrides base class member
paramsSpecifies a parameter array
privateAccessible only within class
protectedAccessible within class or derived class
publicAccessible from anywhere
readonlyAssigned only at declaration or constructor
refPasses argument by reference
returnReturns from a method
sbyte8-bit signed integer
sealedPrevents class inheritance
short16-bit signed integer
sizeofReturns size in bytes
stackallocAllocates memory on the stack
staticDeclares static member or class
stringSequence of characters
structDefines a value type
switchSwitch statement
thisRefers to current instance
throwThrows an exception
trueBoolean literal
tryDefines exception block
typeofGets the type of a class
uint32-bit unsigned integer
ulong64-bit unsigned integer
uncheckedDisables overflow checking
unsafeAllows pointer usage
ushort16-bit unsigned integer
usingIncludes namespaces or manages resources
virtualAllows method overriding
voidNo return type
volatileIndicates variable may be modified by multiple threads
whileStarts a while loop

2. Access Modifiers

ModifierDescription
publicAccessible from anywhere
privateAccessible only in the class
protectedAccessible in base and derived class
internalAccessible within the same assembly
protected internalAccessible in derived classes and same assembly
private protectedAccessible in containing class and derived types in same assembly

3. Data Types

TypeDescription
int32-bit signed integer
floatSingle-precision floating point
doubleDouble-precision floating point
decimalHigh-precision decimal
char16-bit Unicode character
stringSequence of characters
boolBoolean value (true/false)
objectBase type for all types

4. Value vs Reference Types

Value TypesReference Types
int, float, double, bool, char, struct, enum string, object, class, interface, array, delegate

5. Common Operators

OperatorTypeExample
+Arithmetic3 + 2
==Comparisonx == y
&&Logical ANDa && b
||Logical ORa || b
!Logical NOT!true
++Incrementx++
--Decrementy--

Click to go back on notes page.