Home > Article > Backend Development > Object classes in C#
The Object class is the base class for all classes in C#. It has the following methods on C#.
Sr.No | Methods and instructions|
---|---|
1 | Equals(Object) Determine whether the specified object is equal to the current object. |
2 |
Equals(Object,Object, Determines whether the specified object instance is Considered equal.
|
Finalize()Allow objects to try free resources | |
GetHashCode() Default hash function. | |
GetType()The type of the current instance. | |
MemberwiseClone()A shallow copy of the current object. | |
ReferenceEquals(Object,Object)Determine whether the specified Object instance is the same instance. | tr>|
ToString()Returns a string representing the current object. |
using System; namespace MyApplication { class Demo { protected string name = "Website"; protected void Display(string str) { Console.WriteLine("Tabs: " + str); } } class Test : Demo { static void Main(string[] args) { Test t = new Test(); Console.WriteLine("Details: " + t.name); t.Display("Product"); t.Display("Services"); t.Display("Tools"); t.Display("Plugins"); } } }Output
Details: Website Tabs: Product Tabs: Services Tabs: Tools Tabs: Plugins
The above is the detailed content of Object classes in C#. For more information, please follow other related articles on the PHP Chinese website!