C# types

1. A C# program is a collection of types: classes, structs, enums, interfaces, delegates, etc.
2. Pre-defined data types: int, byte, char, string, object, etc. Similar to other language, we can create our own types. There are no global variables nor global functions.
3. Type contains:

  • Data member:
    • Fields, constants, arrays
    • Events
  • Function member:
    • Methods, operators, constructors, destructors
    • Properties, indexers
4. There are 3 categories of types:
  • Value: directly contains data on the stack, cannot be null
  • Pointer (only in unsafe mode)
  • Reference: contains references to objects, may be null. (keeps a reference on the stack, but allocates the real memory on the heap) 

No Response to "C# types"

Post a Comment

 

Copyright © 2013-2014 Lai Duy Thanh All rights reserved.