0

I am a little confused about few statements in C# reference.

  1. Object is a reference type
  2. Struct is Value type
  3. Struct is derived from Object Class

Why shouldn't struct or any other value type also be a reference type in this case.

correct me if any of my assumptions are wrong.

LazyProgrammer
  • 197
  • 5
  • 17

2 Answers2

0

Because it is part of the spec. So, the compiler team is forcing this. I believe there is an article that talks about this being an implementation detail, but cannot find it currently.

You might want to take a look at Struct/Heap Storage question, also. It probably will help clear some things up.

Community
  • 1
  • 1
Justin Pihony
  • 66,056
  • 18
  • 147
  • 180
0

It is because that Struct is a special case, and CLR work with it in special manner.

Kirill Bestemyanov
  • 11,946
  • 2
  • 24
  • 38