A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-object below:

System.Object class - .NET | Microsoft Learn

This article provides supplementary remarks to the reference documentation for this API.

The Object class is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

Because all classes in .NET are derived from Object, every method defined in the Object class is available in all objects in the system. Derived classes can and do override some of these methods, including:

Languages typically don't require a class to declare inheritance from Object because the inheritance is implicit.

Performance considerations

If you're designing a class, such as a collection, that must handle any type of object, you can create class members that accept instances of the Object class. However, the process of boxing and unboxing a type carries a performance cost. If you know your new class will frequently handle certain value types you can use one of two tactics to minimize the cost of boxing.

Although it's sometimes necessary to develop general purpose classes that accept and return Object types, you can improve performance by also providing a type-specific class to handle a frequently used type. For example, providing a class that is specific to setting and getting Boolean values eliminates the cost of boxing and unboxing Boolean values.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4