I'm using C++/CLI only to unit test unmanaged C++ code in VS2010. I switched the compiler to /clr and using the unmanaged code from a static library.
I have a simple int property in my test class.
I would like to pass that as a const int & to a function in native C++. But it can't compile and I've found out that, it's because you can't mix references like that.
What is the way to do it, I tried to following and it's working, but is there a nicer way?
[TestClass]
public ref class MyTestClass
{
private:
    int _my_property;
public:
    [TestMethod]
    void MyTestMethod()
    {
        MyNativeClass c;
        // c.SomeMethod(_my_property) this doesn't work
        int i = _my__property;
        c.SomeMethod(i) // this works
    }
}
 
     
     
    