|using (Foo f = new Foo())
Foo *f = new Foo();
or, if 'Foo' is designed for RAII:
Use C# to C++ Converter to convert from C# to C++.
C++ and C# Equivalents
Copyright © 2004 – 2021 Tangible Software Solutions, Inc.