BOXING UBOXING

hi Team,

i need real time scenario when we will be using Unboxing (converting object data type to Required Datatype)… what makes data to store in Object data type… could you pls guide…

Hi,

How about using CType as the following?

varInt32 = CType(varObj,System.Int32)

Regards,

1 Like

a very common case of we do touch when working with data tables

A data table defines Datacolumns, and A data column defines a datatype
A data row offers the itemArray, representing the row’s column values and is an Object Array - Object()

When we access the column value from a data row we get it initially returned as an Object Datatype
So here we bring it with conversions into the corresponding datatypes
.toString()
Convert.ToXX, CXXX, XXX.Parse…
For more complex DataTypes we would use

Or
DirectCast

So, with the above elaboration we do see how often we touch the initials and do the needed steps

As another example: REF Config Dictionary of the daatypes:
String for the Key,
Object for the value