Blog

How to Determine whether a type is Value type or Reference Type

Posted by Gaurav Gupta Blogs | How do I May 07, 2013
Check the type whether it is a value type or reference type.
You can easily check or determine, whether a type is a Value type or it is a Reference type by using the below code.

Here, I will going to check whether DataTable is value type of reference type?

DataTable MyTable = new  DataTable();

Type T = MyTable .GetType();

bool isValueType  = T.IsValueType;

isValueType will return false.

So, DataTable are Reference Type.
COMMENT USING
PREMIUM SPONSORS
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.