Even though C# allows pointers in 'unsafe' mode, this is not a good practice for converting C++ code to C#. Below is the conversion to typical C#.
Foo *f1 = new Foo();
std::shared_ptr<Foo> f2 = std::make_shared<Foo>();
|Foo f1 = new Foo();
Foo f2 = new Foo();
Use C++ to C# Converter to convert from C++ to C#.
C++ and C# Equivalents
Copyright © 2004 – 2019 Tangible Software Solutions, Inc.