C# Keywords

C# is a programming language developed by Microsoft and it has a set of reserved keywords that have special meanings and purposes within the language. Here are some of the most commonly used C# keywords:

  1. abstract: Used to declare an abstract class or abstract method.
  2. as: Used for type casting or to perform null-safe type conversions.
  3. base: Refers to the base class or constructor of a derived class.
  4. bool: Represents a Boolean value (true or false).
  5. break: Terminates the execution of a loop or switch statement.
  6. byte: Represents an 8-bit unsigned integer.
  7. case: Defines a specific value or condition in a switch statement.
  8. catch: Catches and handles an exception in a try-catch block.
  9. char: Represents a single character.
  10. checked: Enables overflow checking for integral-type arithmetic operations.
  11. class: Declares a class.
  12. const: Declares a constant value.
  13. continue: Skips the current iteration of a loop and continues with the next iteration.
  14. decimal: Represents a decimal floating-point number.
  15. default: Defines the default case in a switch statement or initializes a default value for a variable.
  16. delegate: Declares a delegate that represents a reference to a method.
  17. do: Starts a do-while loop.
  18. double: Represents a double-precision floating-point number.
  19. else: Defines an alternative block of code in an if statement.
  20. enum: Declares an enumeration.
  21. event: Declares an event.
  22. explicit: Defines a user-defined conversion operator.
  23. extern: Declares a method that is implemented externally.
  24. false: Represents the Boolean value false.
  25. finally: Defines a block of code that is always executed, regardless of exceptions.
  26. fixed: Declares a pointer to a fixed-size array.
  27. float: Represents a single-precision floating-point number.
  28. for: Starts a for loop.
  29. foreach: Iterates over elements in a collection.
  30. goto: Transfers the program control to a labeled statement.
  31. if: Defines a conditional statement.
  32. implicit: Defines a user-defined implicit conversion operator.
  33. in: Specifies that a parameter is passed by reference.
  34. int: Represents a 32-bit signed integer.
  35. interface: Declares an interface.
  36. internal: Specifies that a member is accessible within the same assembly.
  37. is: Checks if an object is of a certain type.
  38. lock: Acquires the exclusive lock on an object.
  39. long: Represents a 64-bit signed integer.
  40. namespace: Declares a namespace.
  41. new: Creates an object or initializes a new instance of a class.
  42. null: Represents a null reference.
  43. object: Represents an instance of a class or a value type.
  44. operator: Declares an operator.
  45. out: Specifies that a parameter is passed by reference.
  46. override: Modifies a method, property, indexer, or event in a derived class.
  47. params: Specifies a variable-length parameter list.
  48. private: Specifies that a member is accessible only within its own class.
  49. protected: Specifies that a member is accessible within its own class and derived classes.
  50. public: Specifies that a member is accessible from any code in the same assembly or another assembly.
  51. readonly: Declares a read-only field or property.
  52. ref: Passes a variable by reference.
  53. return: Exits from a method and returns a value.
  54. sbyte: Represents an 8-bit signed integer.
  55. sealed: Prevents a class from being inherited.
  56. short: Represents a 16-bit signed integer.
  57. sizeof: Returns the size in bytes of a type.
  58. stackalloc: Allocates memory on the stack.
  59. static: Declares a static member that belongs to the type itself rather than to a specific object.
  60. string: Represents a sequence of characters.
  61. struct: Declares a value type.
  62. switch: Evaluates a set of conditions and executes the corresponding block of code.
  63. this: Refers to the current instance of a class or struct.
  64. throw: Throws an exception.
  65. true: Represents the Boolean value true.
  66. try: Defines a block of code in which exceptions can occur.
  67. typeof: Gets the Type object of a type.
  68. uint: Represents a 32-bit unsigned integer.
  69. ulong: Represents a 64-bit unsigned integer.
  70. unchecked: Disables overflow checking for integral-type arithmetic operations.
  71. unsafe: Declares an unsafe context, allowing the use of pointers.
  72. ushort: Represents a 16-bit unsigned integer.
  73. using: Specifies a namespace or resource to be used in the program.
  74. virtual: Modifies a method, property, indexer, or event to allow for it to be overridden in derived classes.
  75. void: Specifies that a method does not return a value.
  76. volatile: Specifies that a field can be accessed by multiple threads.

These are the main keywords in C#. Note that some keywords have additional uses or contexts beyond what is listed here.