Coroutines can't return any values, since its return type must be IEnumerator.
Coroutines can't handle exceptions, because yield return statements cannot be surrounded with a try-catch construction.
Синтаксис:
Используется csharp
public IEnumerator GetTimeCor() {
var cor = _actions.StartCoroutine<string>(_actions.GetTimeCor());
yield return cor.coroutine;
string result = null;
try {
result = cor.Value;
} catch (Exception e) {
throw new Exception("Error in SocialMgr.GetTimeCor\n" + e.Message);
}
yield return result;
}
var cor = _actions.StartCoroutine<string>(_actions.GetTimeCor());
yield return cor.coroutine;
string result = null;
try {
result = cor.Value;
} catch (Exception e) {
throw new Exception("Error in SocialMgr.GetTimeCor\n" + e.Message);
}
yield return result;
}
значения возвращает, трайкетчится. если речь о многопоточности, зачем сравнивать с корутинами, которые к потокам отношения не имеют?