What is the root object in the base class library ?
For Java and C# that would be “Object”.
What methods does “Object” have ?
- Equals – Supports comparisons between two objects
- Finalize – Used to perform cleanup operations on un-managed resources being used by the object. Before the object is destroyed.
- GetHashCode – Generates a number based on the value of an object. Used to supported hash tables.
- ToString – Create a human readable piece of text that describes the object.
Is “String” mutable ?
For C# & Java: Strings are always IMMUTABLE
What is Boxing and Un Boxing ?
Process of converting a value type to the type of object or any interface type implemented by this value type. Like storing int in a object which would be “Boxing” (implicit aka do it with out thinking about it). And then taking that object, and “Un-Boxing” it explicitly. Example of this would be something like “int i = (int)x” where x is type of object. Why would you ever want to do this ? Well that’s cause value types get stored in the stack, whereas reference types get stored in the heap. So if your running into performance problems by having a lot of value types floating around in the stack. You can just dump them into the heap, by boxing them.