I have the following code, which I thought would work:
property Nullable<double> Angle {
Nullable<double> get() {
return nullptr;
}
}
It doesn't. How can I do it? Does c++/CLI even support nullable types?
I have the following code, which I thought would work:
property Nullable<double> Angle {
Nullable<double> get() {
return nullptr;
}
}
It doesn't. How can I do it? Does c++/CLI even support nullable types?
OK, found it, after a lot of hassle:
to return null, just do
return Nullable<double>();
to return non-null:
return Nullable<double>(12321);
It is important to declare the return value as Nullable<double>
and not Nullable<double>^
, as if you do it, when using other languages as C# and vb.net, you'll see the type as ValueType
instead of double?
.