int i = 1;
object o = (object) i;
object o = 1;
int i = (int) o;
There is an overhead associated with boxing and unboxing so it’s best to avoid them by doing following. Implement type specific version of the method by overriding them. Use generics instead of objects if possible. Override ToString, Equals, GetHash with defining structures.
// String conversion (no boxing).
public override string ToString()