public NewtypeAttribute(Type underlyingType)Initializes a new NewtypeAttribute wrapping underlyingType.
Parameters
underlyingType- The wrapped underlying type (e.g.,
typeof(Guid)ortypeof(int)).
All Types / Ferrous
public sealed class NewtypeAttribute : Attribute
Marks a readonly partial struct as a zero-overhead Rust-style newtype wrapper around UnderlyingType. Ferrous.Unions generates Value, equality, comparison, parsing, span formatting, [NoDefault], and a NativeAOT-safe System.Text.Json converter.
public NewtypeAttribute(Type underlyingType)Initializes a new NewtypeAttribute wrapping underlyingType.
underlyingTypetypeof(Guid) or typeof(int)).public Type UnderlyingTypeGets the wrapped underlying type.
public bool GenerateJsonConverterGets or sets whether to emit a NativeAOT-safe System.Text.Json converter when System.Text.Json is referenced. Defaults to true.
public bool AllowDefaultGets or sets whether to allow default initialization without [NoDefault] enforcement. Defaults to false (emits [NoDefault]).