Reputation: 85
What are custom value types in C#? How can I create them?
Upvotes: 5
Views: 7010
Reputation: 43743
To create a value type, you need to define your type as a struct
(as opposed to a class
, which defines a reference type). For instance:
struct MyValueType
{
public string MyField;
}
Upvotes: 10