值类型是否像引用类型一样保留类型指针 + 同步根 + 静态字段?

Does a value type keep Type pointer + Sync root + Static fields like a reference type?

值类型是否像引用类型一样保持类型指针+同步根+静态字段?此问题是以下问题的扩展版本:do-value-types-have-type-objects。谁能澄清一下:

Do value types have a related type-object stored in CLR heap?

不,没有。结构没有 header 与之关联,并且没有类型信息与其一起存储。如果您询问 System.Type,是的,类型元数据将在堆中。但它不会预先创建。

Where value type static fields are stored if there is no associated type object in thread stacks?

无论是 ValueType 还是 ReferenceType,静态字段都存储在称为 "High Frequency Heap" 的特殊堆中,每个 AppDomain 都有一个。与 "Garbage Collected Heap" 不同,此堆未被垃圾回收。

Every static variable is stored on the heap, regardless of whether it's declared within a reference type or a value type. There is only one slot in total no matter how many instances are created. (There don't need to be any instances created for that one slot to exist though.) Note that this heap is separate from the normal garbage collected heap - it's known as a "high frequency heap", and there's one per application domain.

Above quote by Jon Skeet

Do value types have sync root field (are value types thread safe if there is no sync root for them)?

不确定你在这里问什么。如果你指的是SyncBlock而不是Sync-Root,它与线程安全无关。