• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

C# Equivalent to C++ Pointers

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 idiomatic C#.

C++ C#
//raw pointer:
Foo *f1 = new Foo();

//'smart' pointer:
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#.     

Additional resource: C++ and C# Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.