I have a third party unmanaged c++ library.
I created a managed c++ wrapper for it since I need to call it from c# code. Problem is one of native c++ functions passes an int by reference. I do not know how to route this through the managed wrapper to the c# code. For example

class A //unmnaged SDK class
void Foo(int& i);

//managed c++ wrapper
public ref class A_Wrapper
A_Wrapper() {_unmanaged = new A();};
~A_Wrapper() {delete unmanaged; };
void Foo(int& i) { _unmanaged->Foo(i)};
A * _unmanaged;

In my c# (yes #) code I try to call A_Wrapper::Foo() but I get compile errors

c# code:
public static void Main()
A_Wrapper aw = new A_Wrapper();
int id = 0;
error CS0214: Pointers and fixed size buffers may only be used in an unsafe context

I don't really want to wrap it in an unsafe {} block. How do I route the pass by reference from c++ to c# properly?