differences between value type and reference type.

Asked 15-Nov-2017
Viewed 910 times

1 Answer


0

"Difference between value type and reference type "

  • Value Type:
    Value Types derive from System.ValueType, which is derived from System.Object.
    In other words, you can say that a data type is a value type that holds data value within its own memory space.
    For example, consider the following integer variable
    int  a=80;
    The system stores 10 in the memory allocated for the variable 'a'.
    differences between value type and reference type

    The following data types are all of the value types:
    •  bool
    • byte
    •  char
    •  decimal
    •  double
    •  enum
    •  float
    •  int
    •  long
    •  sbyte
    • short
    •  struct
    •  uint
    •  ulong
    •  ushort
    Reference Type:
    ReferenceType doesn’t store the value directly. It Stores the address where the value is stored. In other words, you can say that reference type contains a pointer to another memory location that points the address of any variable.
    differences between value type and reference type