Implementing an interface declared in C# from C++/CLI

public ref class MyConcreteClass : public IMyInterface { public: virtual void __clrcall Foo(String^ value) sealed; virtual property String^ __clrcall MyProperty { String^ get() sealed { String::Empty; } } }; Interfaces need to be defined as virtual. Also note the “public IMy..” after the class decleration, it’s a slighly different syntax than C#. If you can, … Read more

How to use Nullable types in c++/cli?

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?.