58

Please help us settle the controversy of "Nearly" everything is an object (an answer to Stack Overflow question As a novice, is there anything I should beware of before learning C#?). I thought that was the case as everything in Visual Studio at least appears as a struct. Please post a reference, so that it doesn't become "modern jackass" (This American Life).

Note that this question refers to C#, not necessarily .NET, and how it handles the data under the hood (obviously it's all 1's and 0's).

Here are the comments to "everything is an object":

  • Eh, no, it's not. – Binary Worrier
  • I'd like an example... – scotty2012
  • isn't everything derived from the base type Object? – rizzle
  • Most things are objects... – Omar Kooheji
  • Value types, ints, doubles, object references (not the objects them selves) etc aren't objects. They can be "boxed" to look like objects (e.g. i.ToString()) but really they're primitive types. Change the entry to "NEARLY everthing is an object" and I'll remove the downvote – Binary Worrier
  • I appreciate the clarification. I think the lowest level that you can interact with, say an int, in C# is as a struct, which isn't an object? - http://msdn.microsoft.com/en-us/library/ms173109.aspx – rizzle
  • Doesn't Int32 inherit from ValueType which inherits from Object? If so, despite the behavior, an int is an object. – Chris Farmer
  • No, the boxed type for int inherits from ValueType, which inherits from Object. They're not objects in the traditional sense because a) an int isn't a reference to an int, IT IS the int. b) ints aren't garbage collected. If you declare an Int32, then that int is 4 bytes on the stack, end of story – Binary Worrier

Definition of object: "Object" as a inheritor of class System.Object vs. "object" as an instance of a type vs. "object" as a reference type."

Community
  • 1
  • 1
missaghi
  • 5,044
  • 2
  • 33
  • 43
  • This is going to be a holy war I think, better to stay out of it :P – annakata Jan 12 '09 at 17:32
  • 2
    @annakata: Except there is a clear answer. Holy wars have no clear answers. – GEOCHET Jan 12 '09 at 17:33
  • 1
    Rizzle! I was just about to post this as a question, to see what the community says. P.S. I'd wait to see what Jon Skeet or Marc Gravell say before selecting an answer. – Binary Worrier Jan 12 '09 at 17:33
  • @Rich B - I think that given furious typing below, it's far from "clear" – annakata Jan 12 '09 at 17:35
  • I've clarified the question to hopefully retard the flames, so to speak. – missaghi Jan 12 '09 at 17:36
  • @annakata: I think you don't understand the difference between a debate and a holy war. – GEOCHET Jan 12 '09 at 17:37
  • 2
    lol - in a debate one side is right and the other is wrong, in a holy war it's the other way around – annakata Jan 12 '09 at 17:39
  • In a holy war no side is correct. That is the problem. – GEOCHET Jan 12 '09 at 17:41
  • 1
    Again, some clarification is needed as to what the intended definition of 'object' is before this discussion can proceed. – Ron Warholic Jan 12 '09 at 17:42
  • 8
    @Binary: The Object class derives from jon skeet? :) – missaghi Jan 12 '09 at 17:44
  • 1
    @annakata - There is an answer for this, its either yes or no. It is not a subjective question. It seems like their is some debate about what the correct answer is, but by clear, I think Rich meant that the question isn't subjective. – James McMahon Jan 12 '09 at 17:45
  • 1
    Please propose a definition of object – missaghi Jan 12 '09 at 17:50
  • 1
    Please, clarify the question. "Object" as a inheritor of class System.Object vs. "object" as an instance of a type vs. "object" as a reference type. – Sunny Milenov Jan 12 '09 at 17:59
  • Everything in C# are value types. And the rest are objects, including value types(when they are boxed). Value types are boxed to object by the compiler(compilation time, not runtime) only when the compiler infers from your code that you want all the good stuff of object unification brings. ... – Michael Buen Jan 12 '09 at 18:00
  • ... E.g. .ToString(), passing to Collections, passing to params, etc. Simply put, you can just say, everything is an object ;-) – Michael Buen Jan 12 '09 at 18:01
  • @rizzle: Doesn't everyone know that? – Binary Worrier Jan 12 '09 at 18:15
  • 1
    @rizzle and @Binary Worrier - I second that request, how do you define an object? Are you referring to the System.Object class (in which case the answer is yes)? – Ricardo Villamil Jan 12 '09 at 18:27
  • ..And this is what I mean when I say it's unclear - the answer is both yes and no, as illustrated by Daniel Schaffer. The parameters of the question itself are subjective. – annakata Jan 12 '09 at 19:38
  • 1
    @rizzle: You've sold me, I've updated my answer below – Binary Worrier Jan 13 '09 at 11:43
  • Does this really deserve to be closed? I found the discussion worth while. – Binary Worrier Jan 13 '09 at 12:02
  • 1
    I don't see how this should be closed - it seems to be a perfectly valid (if too unspecific) question, especially as there does appear to be some confusion on the topic. – Keith Jan 13 '09 at 12:19
  • 1
    Thanks everyone for the discussion. I originally asked this Q because i didn't know about reference types and was trying to reconcile the different behavior of some types in .net. I sure do know about them now! – missaghi Apr 24 '09 at 14:20
  • To summarize all the answers, there are **two meanings** of "object" in C#. **One meaning** has to do with the fact that **members** of `ValueType` and of `Object` can be called on "value types". By this definition, "value types" **are** "objects". The **second meaning** comes from C# spec, which explicitly refers to "instances of reference types" as being "objects", excluding value types. Both meanings are valid viewpoints, though they reach opposite conclusion re value types. A **third POV** is that a "boxed" value type is an "object" but the "raw" value is not. – ToolmakerSteve Jan 20 '21 at 22:11

17 Answers17

81

The problem here is that this is really two questions - one question is about inheritance, in which case the answer is "nearly everything", and the other is about reference type vs value type/memory/boxing, which case the answer is "no".

Inheritance:

In C#, the following is true:

  • All value types, including enums and nullable types, are derived from System.Object.
  • All class, array, and delegate types are derived from System.Object.
  • Interface types are not derived from System.Object. They are all convertible to System.Object, but interfaces only derive from other interface types, and System.Object is not an interface type.
  • No pointer types derive from System.Object, nor are any of them directly convertible to System.Object.
  • "Open" type parameter types are also not derived from System.Object. Type parameter types are not derived from anything; type arguments are constrained to be derived from the effective base class, but they themselves are not "derived" from anything.

From the MSDN entry for System.Object:

Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.

Languages typically do not require a class to declare inheritance from Object because the inheritance is implicit.

Because all classes in the .NET Framework 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.

So not every type in C# is derived from System.Object. And even for those types that are, you still need to note the difference between reference types and value types, as they are treated very differently.

Boxing:

While value types do inherit from System.Object, they are treated differently in memory from reference types, and the semantics of how they are passed through methods in your code are different as well. Indeed, a value type is not treated as an Object (a reference type), until you explicitly instruct your application to do so by boxing it as a reference type. See more information about boxing in C# here.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Daniel Schaffer
  • 56,753
  • 31
  • 116
  • 165
  • Can anyone explain why this is +3 yet it is refuted below? – Joe Phillips Jan 12 '09 at 17:34
  • @d03boy: This is how voting works. More people agree with this answer. – GEOCHET Jan 12 '09 at 17:35
  • -1, this doesn't say that everything in .NET is an object - it just says that Object is the base class for all classes. The number 1 is not an object until it's boxed into one - which isn't always. – TheSoftwareJedi Jan 12 '09 at 17:42
  • 1
    Yes, even structs inherit from System.Object, even though they are value types. – Daniel Schaffer Jan 12 '09 at 17:42
  • @d03boy I think you mean "is an instance of a struct an object?" – TheSoftwareJedi Jan 12 '09 at 17:44
  • 2
    Because he is right. The inheritance chain goes: Object -> ValueType -> Int32. Meaning that Int32 is an object but is also a value type. Methinks that struct is shorthand for ValueType. – Quibblesome Jan 12 '09 at 17:44
  • it's not an object until it's boxed into one though. – TheSoftwareJedi Jan 12 '09 at 17:46
  • So you're telling me when I do int x = 5; string s = x.ToString() that's performing boxing??? – Quibblesome Jan 12 '09 at 17:50
  • Wouldn't that just be creating a new object (the string)? – Daniel Schaffer Jan 12 '09 at 17:51
  • 1
    The point i'm making is that i'm using .ToString() which is defined in the class Object. – Quibblesome Jan 12 '09 at 17:52
  • Yeah, but inheritance isn't all we're talking about here apparently :D – Daniel Schaffer Jan 12 '09 at 17:53
  • You're assuming a "thing" is a class – Joe Phillips Jan 12 '09 at 17:55
  • @Quarrelsome what if it's overridden? – Joe Phillips Jan 12 '09 at 17:56
  • @Quarrelsome - Yes. That is an example of boxing. The primitive has no methods, so it's boxed into a Int32. More on Boxing: http://msdn.microsoft.com/en-us/library/yz2be5wk(VS.80).aspx – TheSoftwareJedi Jan 12 '09 at 17:56
  • @TheSoftwareJedi: its more correct: it's not a reference type until it's boxed into one. It has nothing to do with the name object. Object is only an instance of a type (in OOP). – Sunny Milenov Jan 12 '09 at 17:57
  • 4
    From MSDN: "Boxing and unboxing enable value types to be treated as objects" (http://msdn.microsoft.com/en-us/library/yz2be5wk(VS.80).aspx). Therefore, this implies that the value types ARENT objects if they have to be boxed in order to be "treated as objects". – TheSoftwareJedi Jan 12 '09 at 17:57
  • 4
    This doc is clearly misleading, as this is a bad interpretation of OOP definitions, where object is just the instance of a type. This part of the doc should be interpreted as "enables value types to be threated as reference types". They put in one sentence contradicting terms. – Sunny Milenov Jan 12 '09 at 18:04
  • Edited my answer to account for both questions being asked here. – Daniel Schaffer Jan 12 '09 at 18:05
  • @Sunny Way to reject reality and substitute your own. :) – TheSoftwareJedi Jan 12 '09 at 18:05
  • 1
    @TheSoftwareJedi: because that's how the progress goes - reject a "well known" truths, and replace them with more reliable ones :). Or should we always trust, that if it's on MSDN, this is the definitive truth? Or, that the Earth is flat, because that's what the church said? – Sunny Milenov Jan 12 '09 at 18:09
  • 1
    @TheSoftwareJedi: consider that the MSDN is written by humans and is actually know to contain quite a lot of mistakes, inaccuracies and ambiguities. Don't treat it as holy. In this instance, the MSDN is just badly written. Sunny doesn't substitute *his* reality but a generally accepted one. – Konrad Rudolph Jan 12 '09 at 18:10
  • I've re-asked the question here: http://stackoverflow.com/questions/436363/does-calling-a-method-on-a-struct-result-in-boxing-in-net – Quibblesome Jan 12 '09 at 18:26
  • 1
    Actually they have corrected this document for ver. 3.5 (http://msdn.microsoft.com/en-us/library/yz2be5wk.aspx), and now it reads: "Boxing is the process of converting a value type to the type object..." which is much more precise. – Sunny Milenov Jan 12 '09 at 18:26
  • 2
    What is an object? :) I think it's like a set in mathematics. And what is "everything"? – Mehrdad Afshari Apr 24 '09 at 13:24
  • 1
    More fundementally, WHY overload the term "Object" to mean "reference type" when we already have a term ("Reference Type") to describe that? "Object" means an instance of a Type, and all instances of ALL Types (value AND reference) inherit the methods in System.Object and are instances of a defined Type, so they are "Objects" – Charles Bretana Apr 24 '09 at 14:01
  • 3
    I corrected the section on inheritance. The following C# types do NOT derive from System.Object: interfaces, pointers, type parameters. – HTTP 410 Sep 11 '09 at 12:56
  • 1
    return 1 is object; // truth – Stephen Kennedy Dec 21 '14 at 13:57
  • `So you're telling me when I do int x = 5; string s = x.ToString() that's performing boxing???` No, it is not performing boxing @Quibblesome. People who say it is are mistaken. https://stackoverflow.com/questions/27132042/is-boxing-involved-when-calling-tostring-for-integer-types – mjwills May 17 '21 at 00:58
31

A little late to the party, but I came across this in a search result on SO and figured the link below would help future generations:

Eric Lippert discusses this very thoroughly, with a much better (qualified) statement:

The way to correct this myth is to simply replace "derives from" with "is convertible to", and to ignore pointer types: every non-pointer type in C# is convertible to object.

The gist of it, if you hate reading well-illustrated explanations from people that write programming languages, is that (pointers aside), things like Interface, or generic parameter type declarations ("T") are not objects, but are guaranteed to be treatable as objects at runtime, because they have a definite instance, that will be an Object. Other types (Type, Enum, Delegate, classes, etc.) are all Objects. Including value types, which can be boxed to object as other answers have discussed.

Matt Enright
  • 7,245
  • 4
  • 33
  • 32
15

Some people here have a strange notion of what an “object” in object-oriented programming is. In order for something to be an object it does not have to be a reference type or, more generally, follow any formal implementation.

All that means is that you can operate on it as a first-class citizen in an object-oriented world. Since you can do this on values in C# (thanks to autoboxing), everything is indeed an object. To some extend, this is even true for functions (but arguably not for classes).

Whether this is relevant in practice is another question but this is a general problem with OOP that I notice once again. Nobody is clear on the definition of OOP (yes, most people agree that it has something to do with polymorphism, inheritance and encapsulation, some throw in “abstraction” for good measure).

From a usage point of view, every value in C# handles like an object. That said, I like the currently accepted answer. It offers both technically important aspects.

Notice that in other contexts, e.g. C++, other aspects are stressed since C++ isn't necessarily object-oriented and furthermore is much more focused on low-level aspects. Therefore, the distinction between objects, POD and builtin primitives makes sometimes sense (then again, sometimes not).

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
  • 2
    Are you saying so, that my clinging to primitive types as "not objects" is a hold over from my C++ days, and that ints are objects, even though under the covers they behave completely differently from "instances of classes"? – Binary Worrier Jan 12 '09 at 18:12
  • Yes, that's the gist of it. “object” is a *concept*, not necessarily tied to one fixed implementation and in general it's synonymous with “instance” (which might not make things better). – Konrad Rudolph Jan 12 '09 at 18:26
  • Well, it make's things better for me, I have "seen the light" and will update my answer accordingly. Thanks mate :) – Binary Worrier Jan 13 '09 at 10:31
  • Not everything is an object by this definition. For example a method or an operator are not a first-class citizen, hence not objects. – JacquesB Jan 13 '09 at 18:33
  • @olavk: This is why I wrote “to *some* extend, this is even true for functions”, because methods can be implicitly converted to delegates in many cases (but not in all), and delegates *are* objects. – Konrad Rudolph Jan 14 '09 at 08:01
  • 1
    @Konrad: I prefer to use the terminology relevant to the language in question. The C# spec pretty clearly distinguishes between objects (instances of classes) and value type values. – Jon Skeet Jan 29 '09 at 21:30
8

You're confusing an object with a value or reference. Basically, everything is an object. An Int is an object, but it is also a value type. A class instance is an object, but it is also a reference type.

Methods aren't objects, nor are properties. The just operate on objects. And yes, pretty much everything inherits from the object class.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
BBetances
  • 925
  • 1
  • 14
  • 23
  • 1
    The C# spec distinguishes between an object (an instance of a class) and a value type value. – Jon Skeet Jan 29 '09 at 21:19
  • 1
    All value types are implicitly derived from the Object class: http://msdn.microsoft.com/en-us/library/s1ax56ch(VS.71).aspx – BBetances Jan 29 '09 at 23:45
6

In C# (and in OOP in general) we have types (class - reference, struct - value, etc.). These are the definitions. And the "object" is the concrete instance of a given type.

So, if we read the question literally, yes, everything is an object when instantiated.

The confusion most probably begins with a bad choosing of the name of the very base class for everything. In .NET this is the Object class.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sunny Milenov
  • 21,990
  • 6
  • 80
  • 106
5

They are all treated as objects, but they are not all objects. The confusion comes in with Autoboxing.

See this for more information: http://en.wikipedia.org/wiki/Object_type

The abstraction confuses people apparently.

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
4

I thought that value types are NOT objects. They're stored differently in memory by the CLR - value types are stored on the stack, and objects are stored on the heap. You can cast value types to a reference type to make them act like an object, but the CLR takes the value off of the stack, wraps it in an object, and stores it on the heap. That is what happens when you "box" a variable.

Rich
  • 36,270
  • 31
  • 115
  • 154
  • Yeah this is how Java handles things, I was under the impression .net was the same. – James McMahon Jan 12 '09 at 17:51
  • 3
    Clarification: Value types are ONLY stored on the stack when they are not part of a reference type. Values types which are part of a reference type are stored on the heap along with the rest of the instance. – Brian Rasmussen Jan 12 '09 at 18:08
4

From: Value Types (C# Reference) - MSDN 3.5

All value types are derived implicitly from the System.ValueType.

From: Value Type Class - MSDN 3.5

ValueType overrides the virtual methods from Object with more appropriate implementations for value types.

From: Enum Class - MSDN 3.5

This class inherits from ValueType

The Inheritance Hierarchy is as follows:

  • System.Object
    • System.ValueType
      • System.Enum

Conclusion: Everything is an object

Gavin Miller
  • 43,168
  • 21
  • 122
  • 188
3

Based on all books that I read, everything in C# is an object.

Some are reference other are Value type. Value type object inherit from the class ValueType. They have different behavior but inherently ... objects.

This is the reason why you can store an Int32 in an object variable as well as everything that you can ever create in .NET.

For more detail... look at the following: http://msdn.microsoft.com/en-us/library/s1ax56ch(VS.71).aspx

All value types are derived implicitly from the Object class.

Maxime Rouiller
  • 13,614
  • 9
  • 57
  • 107
3

While everyone seems to be focusing on the value types vs. reference types debate, we are forgetting one type in C# that is neither reference nor value, it doesn't derive from object, and it can't be cast to object: pointers.

Unlike values and reference types, pointers cannot be cast to object.

According to the MSDN documentation on C# pointer types,

Pointer types do not inherit from object and no conversions exist between pointer types and object. Also, boxing and unboxing do not support pointers. However, you can convert between different pointer types and between pointer types and integral types.

Judah Gabriel Himango
  • 58,906
  • 38
  • 158
  • 212
2

Short answer: No.

The answer hinges on the definition of "object". Different languages have different definitions of what "object"-means, but the authoritative definition for C# is the official C# Language Specification:

The types of the C# language are divided into two main categories: reference types and value types. (...) Value types differ from reference types in that variables of the value types directly contain their data, whereas variables of the reference types store references to their data, the latter being known as objects.

So according to the C#, an object is an instance of a reference type. Value type values are therefore not objects. So it is not true that everything is an object in C#.

However:

C#’s type system is unified such that a value of any type can be treated as an object. (...) Values of value types are treated as objects by performing boxing and unboxing operations (§9.3.12).

So a value type can be treated as an object by boxing it (effectively turning into a reference type). But an unboxed value type is not in itself an object.

The CLR Specification [PDF] uses a definition very similar to C#:

object: An instance of a reference type. An object has more to it than a value. An object is self-typing; its type is explicitly stored in its representation. It has an identity that distinguishes it from all other objects, and it has slots that store other entities (which can be either objects or values). While the contents of its slots can be changed, the identity of an object never changes.

So in the CLR terminology, a value type value is not an object either.

JacquesB
  • 41,662
  • 13
  • 71
  • 86
  • 1
    The specs are online at Github now, so it's possible to add a link directly to the relevant article on [Types](https://github.com/dotnet/csharplang/blob/main/spec/types.md) – Panagiotis Kanavos May 20 '21 at 09:09
1

Addressing the semantics, Why overload the word "object" so that it means "reference type" when we already have a perfectly good, unambiguous term for that -> "Reference Type", and the when, by overloading the word "Object" in this way we create the confusion this thread demonstrates... i.e., the mismatch between the fact that all Types, (including value types), inherit the implementation defined in the Type "System.Object". Clearly, this is at best unnecessary, and at worst extremely confusing.. Even the fact that the MS documentation is at times confusing on this issue is no excuse to propagate the confusion.

Much easier, and clearer, is to just define and use the term "object" to mean an instance of ANY type, value or reference, and the phrase "Reference Type" to describe the Types that use pointer variables and have their state stored on the Heap ...

Charles Bretana
  • 143,358
  • 22
  • 150
  • 216
0

The number 2 is not an object.

Joe Phillips
  • 49,743
  • 32
  • 103
  • 159
  • 2
    but it is stored as a Int32, which is an object. – scottm Jan 12 '09 at 17:32
  • 2
    But it's not boxed into an object until it's needed to be. Thus, it's not ALWAYS an object. – TheSoftwareJedi Jan 12 '09 at 17:40
  • You mean its not boxed into an object until the program is running? or the code is being interpreted? – scottm Jan 12 '09 at 17:42
  • I think he's saying that it is stored as a primitive and then autoboxed when it is used. In my eyes, that makes it different than an Object. – Joe Phillips Apr 24 '09 at 15:21
  • If you have the code `int x = 2 + 3;` neither the `x`, nor the 2 nor 3 are objects. However, calling `Object.equals( 2, 3 )` boxes 2 and 3 into two Objects. – Adam Luter Aug 13 '09 at 12:09
0

This a discussion of two worlds: language and memory.

To me language is like a layer of abstraction and the term object belongs to this level of abstraction. I don't see a point in talking about objects in terms of memeory organisation and if you do use the "object" term when talking about memory you actually are borrowing this term from a different layer of abstraction. Thus you shouldn't forget where it came from.

If we're talking about C# I don't undestand why someone would use memory organisation as an argument. Of course if I would answer this question to someone I would say "Yes, in C# everything is an object, but you also should know that under the hood it may work differently depending on...."

This may start an interesting argument but may also speak to some: in a similar discussion one could say that actually there is no object oriented programming, there's only procedural programming. Does you CPU understand objects? Even better, actually there is no software, there's only differnt hardware states :)

My point is that some terms don't translate to other layers of abstraction and you should stick the discussion to where it belongs (which in this case is a language, not memory).

Even the author of this question stated: "Note that this question refferes to C# not necessarily .NET and how it handles the data under the hood (obviously it's all 1's and 0's.)"

Piotr Owsiak
  • 6,081
  • 8
  • 39
  • 42
-1

Value types are not objects, they obey different copying semantics, different passing semantics, and must be wrapped in a class (Object) in order to be treated as such.

Edit: I think the argument is somewhat vague, as you must qualify what you mean by 'object'. Is an object just something that inherits from Object, or is it something that obeys Object's use semantics? Or are we talking the most general definition of object, where it is anything that can contain data and operations on that data?

Ron Warholic
  • 9,994
  • 31
  • 47
-1

Considering that the question is referring to Object in a OOP sense, the answers is:

From a technical point of view the answer is: No

From a dogmatic point of view the answer is: Yes

Explanation:

Technically value types (primitives or structs) are not objects unless in "boxed" form, but because the .Net does seamless conversions of value types to their Object counterpart through the act of boxing/unboxing (creating a class instance that holds the value and is derived from Object) that means value types can be treated as both objects and simple values.

So value types are dual in nature, they behave as values and as objects. Values in .Net are Objects when they need to be, and they are not objects in the rest of cases.

The correct answer that takes the technical aspect into consideration is "Everything in .Net is as if it were an Object".

The dogmatic answer is "Everything is an Object".

Pop Catalin
  • 61,751
  • 23
  • 87
  • 115
-3

One of the reasons why there are so many different answers is that the question is very imprecise. What does "everything" mean? Does it really mean every C# language element? Then the answer is clearly "no": Operators are not objects, the "using" keyword is not an object, comments are not objects, etc.

But if this was not meant, what was then meant? Maybe "everything apart from those things that are obviously not classes"? This is obviously not helpful as different people have different opinions on what is "obvious". Nevertheless, most answers seem to follow along this line of opinionated interpretation.

Another source of confusion is around the term "object". What is an object? There is no unique universal definition of this term and different people seem to use it in a different way. The only formal definition in the C# language is the definition of the System.Object type and which other types derive from it and which not. This documentation is readily available and more can't be said about it.

KloppyToppy
  • 244
  • 2
  • 5
  • 1
    Thank you for contributing an answer to StackOverflow. However, this answer over-generalizes beyond the scope needed to address the question. As you can see from existing answers, there are *two* possible meanings of "object" in C#. **One meaning** has to do with the fact that **members** of `ValueType` and of `Object` can be called on "value types". By this definition, "value types" **are** "objects". The **second meaning** comes from C# spec, which explicitly refers to "instances of reference types" as being "objects", excluding value types. Both are valid viewpoints. – ToolmakerSteve Jan 20 '21 at 22:06