#Nullable type semantics
1 messages · Page 1 of 1 (latest)
wouldn't they be different (specifically !=) for UnityEngine.Object
These checks are being done on Nullable<T>, not on the T itself so it shouldn't matter
🤔 is Nullable<T> the same as T??
Confusingly, no.
TStruct? is a syntax sugar for Nullable<TStruct>, which is a wrapper type that actually exists at runtime.
TClass? is just TClass but with NRT, which is just a compile time feature that doesn't exist at runtime.
This nullable divide brings not only confusion but also extra baggage when dealing with generics, think T? Get<T>().
Yeah, I don't see a point in using nullables for reference types. It can be useful for structs, but too confusing otherwise.
danke