Concept |
Description |
public |
Accessible from any code, anywhere in the project. |
private |
Accessible only within the same class or struct. |
protected |
Accessible within the same class and derived classes. |
internal |
Accessible within the same assembly. |
protected internal |
Accessible within its own assembly or by derived classes. |
class |
Defines a class, a blueprint for creating objects. |
interface |
Declares a contract that classes can implement. |
struct |
Creates a value type holding data directly. |
enum |
Defines an enumeration, a set of named constants. |
record |
Defines an immutable data class. |
string |
Represents text data. |
int |
A 32-bit integer. |
bool |
Represents a Boolean value (true or false). |
double |
A double-precision floating-point number. |
decimal |
Used for high-precision decimal numbers. |
var |
Allows the compiler to infer the type of a variable. |
static |
Belongs to the type itself rather than an instance. |
virtual |
Allows a method to be overridden in a derived class. |
override |
Provides a new implementation of a virtual method. |
abstract |
Must be implemented by derived classes. |
async |
Marks a method as asynchronous. |
await |
Waits for the completion of an asynchronous operation. |
if, else |
Executes code based on a conditional expression. |
switch |
Allows multiple branches of execution. |
for, foreach |
Used for iterating over collections or repeating code. |
while, do |
Executes a block of code repeatedly. |
break |
Exits a loop or a switch statement. |
continue |
Skips the rest of the current loop iteration. |
return |
Exits a method and optionally returns a value. |
throw |
Throws an exception. |
try, catch, finally |
Surrounds code that might throw an exception. |
null |
Represents the absence of a value. |
default |
Provides the default value of a type. |
using |
Ensures that resources are properly disposed of. |
is |
Checks if an object is of a specific type. |
as |
Safely converts an object to a specific type. |
new() |
Instantiates a new object. |
nameof |
Retrieves the name of a variable or type as a string. |
when |
Adds a condition to pattern matching. |
fixed |
Pins a pointer in memory to prevent garbage collection from moving it. |
unsafe |
Allows code that uses pointers. |
stackalloc |
Allocates memory on the stack. |
volatile |
Indicates that a field may be modified by multiple threads. |
value |
Refers to the value being assigned in a property setter. |
get |
Defines a property accessor that retrieves the value. |
set |
Defines a property mutator that sets the value. |
yield |
Used in iterator methods to provide a value to the enumerator object. |
partial |
Allows a class or method to be defined in multiple files. |
where |
Specifies constraints on generic type parameters. |