Monday , December 11 2017
Home / Dot Net / C# / Lesson 8: Object In C#

Lesson 8: Object In C#

c# object: A class and an object are different things. A class defines a type of object, but it is not an object itself. An object is a concrete entity based on a class, and is sometimes referred to as an instance of a class.

Objects can be created by using the new keyword followed by the name of the class that the object will be based on, like this:

Syntax:

Example:

Example :

Output:

 

The object type is an alias for Object in the .NET Framework. In the unified type system of C#, all types, predefined and user-defined, reference types and value types, inherit directly or indirectly from Object. You can assign values of any type to variables of type object. When a variable of a value type is converted to object, it is said to be boxed. When a variable of type object is converted to a value type, it is said to be unboxed. For more information, see Boxing and Unboxing.

 

Print Friendly, PDF & Email

Give us your valuable feedback

comments

About Jagan Palika

Tech Genius

Check Also

How to Send an Email In Perfect way Using C#

How to Send an Email In Perfect Way using C#: Now a days for every …

%d bloggers like this: