[WEBINAR] The New Normal: Dealing with the Reality of an Unsecure World


Definition - What does Object mean?

Object, in C#, is an instance of a class that is created dynamically. Object is also a keyword that is an alias for the predefined type System.Object in the .NET framework.

The unified type system of C# allows objects to be defined. These can be user-defined, reference or value type, but they all inherit directly or indirectly from System.Object. This inheritance is implicit so that the type of the object need not be declared with System.Object as the base class.

In general, object type is useful where there is a requirement to build generic routines. Because values of any type can be assigned to variables of object type, object type is used mostly in designing classes that handle objects of any type that allow code to be reused. The non-generic collection classes in the .NET framework library, such as ArrayList, Queue, etc., use object type to define various collections.

An object is also known as instance.

Techopedia explains Object

An object consists of instance members whose value makes it unique in a similar set of objects.
All the objects used in C# code are of object type.

When an object is instantiated, it is allocated with a block of memory and configured as per the blueprint provided by the class underlying the object. Objects of value type are stored in stack, while those of reference type are allocated in the heap.

Since the execution of C# code is in the managed environment of .NET, wherein the garbage collector provides automatic memory reclamation, it is not necessary or possible to explicitly de-allocate memory that is allocated for objects. Objects of value type are destroyed when they go out of scope, while reference type objects are destroyed in a non-deterministic manner until the last reference to them is removed.

The two operations related to objects created in C# are boxing and unboxing. While boxing implies the conversion of value type to object, unboxing refers to the conversion from object to a value type. Boxing and unboxing operations need to be used carefully because they can put a drag on performance.

This definition was written in the context of C#

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.