Esempio n. 1
0
        public static async Task <OperationDetails> Wrap(Func <OperationDetails, Task> func, [CallerMemberName] string operationName = "")
        {
            var res = new OperationDetails(operationName);

            try
            {
                await func.Invoke(res);
            }
            catch (Exception e)
            {
                res.SetException(e);
            }
            return(res);
        }
Esempio n. 2
0
        public static OperationDetails Wrap(Action <OperationDetails> action,
                                            [CallerMemberName] string operationName = "")
        {
            var res = new OperationDetails(operationName);

            try
            {
                action.Invoke(res);
            }
            catch (Exception e)
            {
                res.SetException(e);
            }
            return(res);
        }