In my C # code, I have the following array:
var prices = new[] {1.1, 1.2, 1.3, 4, 5,};
I need to pass it as a parameter to a C ++ managed module.
var discountedPrices = MyManagedCpp.GetDiscountedPrices(prices) ;
What should the GetDiscountedPrices signature look like? In the most trivial case, when discounted prices are equal to prices, what should the C ++ GetDiscountedPrices method look like?
Edit: I managed to assemble it. My C # code:
[Test] public void test3() { var prices = new ValueType[] {1.1, 1.2, 1.3, 4, 5,}; var t = new TestArray2(prices , 5); }
My C ++ code is:
TestArray2( array<double^>^ prices,int maxNumDays) { for(int i=0;i<maxNumDays;i++) {
However, I get a runtime error:
System.InvalidCastException: The specified listing is not valid.
Edit: The Kevin solution is working. I also found a useful link: C ++ / CLI Keywords: under the hood