일부 코드 실행을 측정하려고하는데 몇 분 안에 표시해야합니다. 나는 시간 범위 내가 사용하려고, 더 쉽게 포맷 할 수 있습니다 발견 이후 :C++ clip timespan 형식이 작동하지 않습니다.
TimeSpan ts = TimeSpan::FromTicks(complete-commence);
String elapsedTime = TimeSpan::Format("mm", ts.Minutes);
을하지만 방법은 MSDN에 존재에도 불구하고, 작동하지 않는 :
Error 1 error C3149: 'System::String' : cannot use this type here without a top-level '^'
Error 2 error C2039: 'Format' : is not a member of 'System::TimeSpan'
Error 3 error C3861: 'Format': identifier not found
내가 뭘 잘못 했습니까?
String은 참조 유형이고^hat가 누락되어 TimeSpan에 Format() 메소드가 없습니다. ToString() 메서드는 .NET 4.0에서만 작동합니다. 확실한 대안은 ts.Minutes.ToString()입니다. –