C# Data Types and Keywords :

Data Types :

Basic Data Types :

TypeRepresentRange
boolBoolean value True or False
byte8-bit unsigned integer0 to 255
char16-bit Unicode characterU +0000 to U +ffff
decimal128-bit precision decimal values(-7.9 x 1028 to 7.9 x 1028)/100 to 28
double64-bit double-precision floating point type(+/-)5.0 x 10-324 to (+/-)1.7 x 10308
float32-bit single-precision floating point type-3.4 x 1038 to + 3.4 x 1038
Int32-bit signed integer type-2,147,483,648 to 2,147,483,647
long64-bit signed integer type-923,372,036,854,775,808 to 9,223,372,036,854,775,807
sbyte8-bit signed integer type-128 to 127
short16-bit signed integer type-32,768 to 32,767
uint32-bit unsigned integer type0 to 4,294,967,295
ulong64-bit unsigned integer type0 to 18,446,744,073,709,551,615
ushort16-bit unsigned integer type0 to 65,535

value types and reference types :

  • Value types
    • Simple Types
      • Signed integral: sbyte, short, int, long
      • Unsigned integral: byte, ushort, uint, ulong
      • Unicode characters: char
      • IEEE floating point: float, double
      • High-precision decimal: decimal
      • Boolean: bool
    • Enum types
      • User-defined types of the form enum E {...}
    • Struct types
      • User-defined types of the form struct S {...}
    • Nullable value types
      • Extensions of all other value types with a null value
  • Reference types
    • Class types
      • Ultimate base class of all other types: object
      • Unicode strings: string
      • User-defined types of the form class C {...}
    • Interface types
      • User-defined types of the form interface I {...}
    • Array types
      • Single- and multi-dimensional, for example, int[] and int[,]
    • Delegate types
      • User-defined types of the form delegate int D(...)

C# Reserved Keywords :

  1. abstract
  2. as
  3. base
  4. bool
  5. break
  6. byte
  7. case
  8. catch
  9. char
  10. checked
  11. class
  12. const
  13. continue
  14. decimal
  15. default
  16. delegate
  17. do
  18. double
  19. else
  20. enum
  21. event
  22. explicit
  23. extern
  24. false
  25. finally
  26. fixed
  27. float
  28. for
  29. foreach
  30. goto
  31. if
  32. implicit
  33. In
  34. in (generic modifier)
  35. int
  36. interface
  37. internal
  38. is
  39. lock
  40. long
  41. namespace
  42. new
  43. null
  44. object
  45. operator
  46. out
  47. out (generic modifier)
  48. override
  49. params
  50. private
  51. protected
  52. public
  53. readonly
  54. ref
  55. return
  56. sbyte
  57. sealed
  58. short
  59. sizeof
  60. stackalloc
  61. static
  62. string
  63. struct
  64. switch
  65. this
  66. throw
  67. true
  68. try
  69. typeof
  70. uint
  71. ulong
  72. unchecked
  73. unsafe
  74. ushort
  75. using
  76. virtual
  77. void
  78. volatile
  79. while

Note : Here we mix/shuffle all Reserved Keywords with 2 colors , cause if all options is belong some color then we think some time reader confused which one he read or which one not (mistake) so, here we use 2 type colors.


Identifiers :

An identifier is a name used to identify a class, variable, function, or any other user-defined item. The basic rules for naming classes in C# are as follows:

  • A name must begin with a letter that could be followed by a sequence of letters, digits (0 - 9), or underscore. The first character in an identifier cannot be a digit.

  • It must not contain any embedded space or symbol like ? - +! @ # % ^ & * ( ) [ ] { } . ; : " ' / and \. However, an underscore ( _ ) can be used.

  • It should not be a C# keyword.

Computer Science Engineering

Special Notes

It's a special area where you can find special questions and answers for CSE students or IT professionals. Also, In this section, we try to explain a topic in a very deep way.

CSE Notes