struct MyValueType
{
    int myInt;
}
class MyReferenceType
{
    int myInt;
}
void MyMethod()
{
    MyValueType v;
    MyReferenceType r;
    v.myInt = 5;
    r.myInt = 5;
} // neither value nor reference type needs to be manually removed from memory!

Example 2: Variable v is a value type; variable r is a reference type.

Back to Article