public TResult GetResult() { var result = _awaiter.GetResult(); _restoreState(result.Item2); return(result.Item1()); }
public static string GetXmlDataFromBCMTIOpen511API(string service, string queryString = null) { //Establish parameters of ssl connection Uri bcMTIOpen511Uri = new Uri(defaultBcMTIOpen511Uri); ServicePoint pointOfService = ServicePointManager.FindServicePoint(bcMTIOpen511Uri); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string httpResponseBody; using (HttpClient clientInstance = new HttpClient()) { //Transmit GET to BCMTI api service Task <HttpResponseMessage> messageTask = clientInstance.GetAsync(defaultBcMTIOpen511Uri + service + "?" + queryString); System.Runtime.CompilerServices.TaskAwaiter <HttpResponseMessage> messageProcessor = messageTask.GetAwaiter(); HttpResponseMessage responseMessage = messageProcessor.GetResult(); //Capture reply of BCMTI api service Task <string> replyTask = responseMessage.Content.ReadAsStringAsync(); System.Runtime.CompilerServices.TaskAwaiter <string> replyProcessor = replyTask.GetAwaiter(); httpResponseBody = replyProcessor.GetResult(); } return(httpResponseBody); }
public void DisplayValue1() { System.Runtime.CompilerServices.TaskAwaiter <double> awaiter = GetValueAsync(1234.5, 1.01).GetAwaiter(); awaiter.OnCompleted(() => { double result = awaiter.GetResult(); Console.WriteLine("Value is : " + result); }); }
protected ReportResponse FindString(ReportRequest request) { ReportResponse response2 = new ReportResponse(); if (string.IsNullOrEmpty(request.FindString)) { response2.Status = 2; response2.Message = "Search value can not be empty."; return(response2); } try { ReportExecuteResult result = new ReportExecuteResult(); this.LoadReport(request, ref result); this.Render(request, ref result, null); this.GetPageNumber(request, ref result); AspNetCore.Report.ReportExecutionService.FindStringRequest request2 = new AspNetCore.Report.ReportExecutionService.FindStringRequest { FindValue = request.FindString, StartPage = request.PageIndex, EndPage = result.PageCount }; System.Runtime.CompilerServices.TaskAwaiter <AspNetCore.Report.ReportExecutionService.FindStringResponse> awaiter = this.ReportClient.FindStringAsync(request2).GetAwaiter(); AspNetCore.Report.ReportExecutionService.FindStringResponse response = awaiter.GetResult(); if (response.PageNumber > 0) { ReportExecuteResult reportExecuteResult = result; int num2 = reportExecuteResult.PageIndex = (request.PageIndex = response.PageNumber); } else { if (request.PageIndex > 1) { request2.StartPage = 1; } awaiter = this.ReportClient.FindStringAsync(request2).GetAwaiter(); response = awaiter.GetResult(); if (response.PageNumber < 1) { response2.Status = 23; response2.Message = "The Find Text not found in the report"; return(response2); } ReportExecuteResult reportExecuteResult2 = result; int num2 = reportExecuteResult2.PageIndex = (request.PageIndex = response.PageNumber); } this.Render(request, ref result, null); response2.Data = this.SetData(result, true); response2.Data.Contents = this.GetContent(result.Stream, this.ReportSettings.ShowToolBar); } catch (System.Exception ex) { response2.Status = 1; response2.Message = ex.Message; } return(response2); }
//我们可以效仿一下异步任务 public void AlikeMethod() { System.Runtime.CompilerServices.TaskAwaiter <int> awaiter = QueryScore().GetAwaiter(); awaiter.OnCompleted(() => { int result = awaiter.GetResult(); string info = $"您的考试成绩是:{result}"; Console.WriteLine(info); }); }
static StackObject *GetResult_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.Runtime.CompilerServices.TaskAwaiter <System.String> instance_of_this_method = (System.Runtime.CompilerServices.TaskAwaiter <System.String>) typeof(System.Runtime.CompilerServices.TaskAwaiter <System.String>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); var result_of_this_method = instance_of_this_method.GetResult(); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static StackObject *GetResult_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.Runtime.CompilerServices.TaskAwaiter instance_of_this_method = (System.Runtime.CompilerServices.TaskAwaiter) typeof(System.Runtime.CompilerServices.TaskAwaiter).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 16); instance_of_this_method.GetResult(); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); return(__ret); }
static StackObject *GetResult_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.Runtime.CompilerServices.TaskAwaiter <Google.Protobuf.Adapt_IMessage.Adaptor> instance_of_this_method = (System.Runtime.CompilerServices.TaskAwaiter <Google.Protobuf.Adapt_IMessage.Adaptor>) typeof(System.Runtime.CompilerServices.TaskAwaiter <Google.Protobuf.Adapt_IMessage.Adaptor>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); var result_of_this_method = instance_of_this_method.GetResult(); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance)); } return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
/// <summary> /// </summary> public T GetResult() { return(m_awaiter.GetResult()); }
public TResult GetResult() { return _awaiter.GetResult(); }