Question

Is datatable/dataset is value type of reference type?

But the most important question in my mind is- "how to find whether a type is a value type or reference type?"

Was it helpful?

Solution

They are both reference types.

You can look up the information on MSDN - if they are classes, they are reference types, if structs, value types.

See DataTable and DataSet. As you can see, they are both declared as classes.

OTHER TIPS

You can use the Type.IsValueType method.

Both are reference type

DataTable dt = new  DataTable();

Type t = dt.GetType();

bool isValueType  = t.IsValueType;

isValueType will return false.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top