Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dataset/datatable is a value type or reference type

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?"

like image 617
Zerotoinfinity Avatar asked Mar 07 '26 12:03

Zerotoinfinity


2 Answers

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.

like image 68
Oded Avatar answered Mar 10 '26 02:03

Oded


You can use the Type.IsValueType method.

like image 45
Rich O'Kelly Avatar answered Mar 10 '26 03:03

Rich O'Kelly