Manage data in a .NET Framework application
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
Exam 70-536 Preparation Guide: Manage data in a .NET Framework application by using the .NET Framework 2.0 system types. (System namespace)
|
Contents |
Fundamental types
The following table lists the fundamental types of the .NET Framework which are found in the System namespace:
| Fundamental types | |
| Namespace | Description |
System.Object
| Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework: it is the root of the type hierarchy. |
System.ValueType
| Provides the base class for all value types. |
System.Nullable
| Supports a value type that can be assigned a null reference (like a reference type). Cannot be inherited.
|
System.String
| A built-in reference type. |
System.Array
| All arrays—even if their elements are value types. |
System.Attribute
| A method of associating declarative information with C# code—methods, properties, types, etc. Once associated with a program entity, the attribute can be queried at run time using a technique called reflection. |
System.Exception
| Provides the base class for all exceptions. |
System.Runtime.
| Specifies a destination type in another assembly. |
Data types
C# supports two categories of data types: value types and reference types. The main difference between these two types is how their values are stored in memory.
Value types
Value types have their value stored on the stack—like variables in C++—unless they are embedded within a reference type. Value types include all of the standard predefined integral data types as well as structures and enumerations. All of the simple types—those integral to the C# language—are aliases of the .NET Framework System types.
The Stack
The stack is a section of memory that exists for the currently executing part of the program, and typically holds reserved space for local variables.
Memory reserved in the program stack, for a particular method, is reclaimed and subsequently reused automatically when the method returns.
For Example: If method A calls method B before returning, method A's stack memory will persist all the way through until method A finishes, including the portion of the time that method B is being executed.
Reference types
Reference types sit on the stack, but they hold the address of an object on the heap, much like pointers in C++. Reference types include objects and strings.
Reference types store the address of their data, also known as pointers, on the stack. The actual data that address refers to is stored in an area of memory called the heap.
The Heap
The heap is a section of reserved memory that might persist past the current method, thread, or, possibly, the entire lifetime of the program.
The runtime environment manages the memory used by the heap through a process called garbage collection. Periodically, garbage collection recovers memory as needed by disposing of items that are no longer referenced.
|

