What Is Boxing And Unboxing In C

Best SPORT image references website

What Is Boxing And Unboxing In C. It is the process of converting a reference type to value type. This happens by copying the value to the heap and creating a reference to it the new object.

Behind The Scenes While Boxing And Unboxing Stack Overflow
Behind The Scenes While Boxing And Unboxing Stack Overflow from stackoverflow.com

Basically it converts a value type to a reference type and vice versa. Boxing and unboxing in c allows developers to convert net data types from value type to reference type and vice versa. Unboxing extracts the value type from the object.

Boxing and unboxing is a essential concept in c s type system.

An example of this is seen below. Unboxing is the reverse of boxing. Value types int char etc reference types object and pointer types. It means we have to cast explicitly.