System::DateTime ^now = System::DateTime::Now;
System::DateTime ^now2 = System::DateTime::Now;
System::TimeSpan ^span = now->Subtract(now2);
The above code gets the compiler error:
test.cpp(104) : error C2664: 'System::TimeSpan System::DateTime::Subtract(System::DateTime)' : cannot convert parameter 1 from 'System::DateTime ^' to 'System::DateTime'
1> No user-defined-conversion operator available, or
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
now and now2 are c++/cli handles, but the method expects the actual object. What is the correct way of invoking the method from c++/cli?
DateTimeandTimeSpanare value types.