The Object Class

Good job! In this lesson you learned that:

  • Every type, eventually, inherits from Object
  • Object members include Equals(), ToString(), and GetType()
  • The ToString() method allows Console.WriteLine() to work for all types


Try reading the “Remarks” section of the Object class documentation. It’s a good way to check your understanding.

The last section, “Performance Considerations”, talks about strategies to avoid unnecessary “unboxing” and “boxing”, which you probably know as casting.

You can see the first strategy in action with Console.WriteLine(). In the documentation, you can see that there are multiple versions of the method with different parameter types: some of the more common types like int and string and of course Object.

If you have any trouble finding those three versions, here are direct links:

Don’t worry too much about the other strategy that uses generics: you aren’t expected to understand it because we haven’t yet covered the concept!

Folder Icon

Take this course for free

Already have an account?