1.

Is It True That All C# Types Derive From A Common Base Class?

Answer»

YES and no. All types can be treated as if they derive from OBJECT (System.Object), but in order to treat an instance of a value type (e.g. int, FLOAT) as object-derived, the instance must be CONVERTED to a reference type using a process called 'boxing'. In theory a developer can forget about this and let the run-time worry about when the conversion is necessary, but in reality this implicit conversion can have side-effects that may trip up the unwary.

Yes and no. All types can be treated as if they derive from object (System.Object), but in order to treat an instance of a value type (e.g. int, float) as object-derived, the instance must be converted to a reference type using a process called 'boxing'. In theory a developer can forget about this and let the run-time worry about when the conversion is necessary, but in reality this implicit conversion can have side-effects that may trip up the unwary.



Discussion

No Comment Found