当前位置: 首页>>代码示例>>C#>>正文


C# Result.GetType方法代码示例

本文整理汇总了C#中System.Result.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Result.GetType方法的具体用法?C# Result.GetType怎么用?C# Result.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Result的用法示例。


在下文中一共展示了Result.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddMobileResult

 public void AddMobileResult(string requestID, Result result)
 {
     Console.WriteLine("{0} A {1} is ready",LogTimestamp,result.GetType().Name);
     resultsLock.EnterWriteLock();
     try
     {
         results.Add(requestID, result);
     }
     finally
     {
         resultsLock.ExitWriteLock();
     }
 }
开发者ID:RSUDHAKARREDDI,项目名称:darpooling,代码行数:13,代码来源:DarPoolingServiceMobile.cs

示例2: DeleteReturn

        public DeleteReturn(APIObject theObject)
        {
            string OverallStatus = string.Empty, RequestID = string.Empty;
            Result[] requestResults = new Result[0];

            theObject.AuthStub.refreshToken();
            using (var scope = new OperationContextScope(theObject.AuthStub.soapclient.InnerChannel))
            {
                //Add oAuth token to SOAP header.
                XNamespace ns = "http://exacttarget.com";
                var oauthElement = new XElement(ns + "oAuthToken", theObject.AuthStub.internalAuthToken);
                var xmlHeader = MessageHeader.CreateHeader("oAuth", "http://exacttarget.com", oauthElement);
                OperationContext.Current.OutgoingMessageHeaders.Add(xmlHeader);

                var httpRequest = new System.ServiceModel.Channels.HttpRequestMessageProperty();
                OperationContext.Current.OutgoingMessageProperties.Add(System.ServiceModel.Channels.HttpRequestMessageProperty.Name, httpRequest);
                httpRequest.Headers.Add(HttpRequestHeader.UserAgent, theObject.AuthStub.SDKVersion);
                theObject = this.TranslateObject(theObject);
                requestResults = theObject.AuthStub.soapclient.Delete(new DeleteOptions(), new APIObject[] { theObject }, out RequestID, out OverallStatus);

                this.Status = true;
                this.Code = 200;
                this.MoreResults = false;
                this.Message = "";

                if (OverallStatus != "OK")
                {
                    this.Status = false;
                }

                if (requestResults.GetType() == typeof(DeleteResult[]) && requestResults.Length > 0)
                {
                    List<ResultDetail> results = new List<ResultDetail>();
                    foreach (DeleteResult cr in requestResults)
                    {
                        ResultDetail detail = new ResultDetail();
                        if (cr.StatusCode != null)
                            detail.StatusCode = cr.StatusCode;
                        if (cr.StatusMessage != null)
                            detail.StatusMessage = cr.StatusMessage;
                        if (cr.Object != null)
                            detail.Object = this.TranslateObject(cr.Object);
                        detail.OrdinalID = cr.OrdinalID;
                        detail.ErrorCode = cr.ErrorCode;
                        results.Add(detail);
                    }
                    this.Results = results.ToArray();
                }
            }
        }
开发者ID:salesforce-marketingcloud,项目名称:FuelSDK-CSharp,代码行数:50,代码来源:ET_Client.cs

示例3: ReturnResultToClient

        private void ReturnResultToClient(Result finalResult, IDarPoolingCallback destination)
        {
            /** Apply changes on the service. */
            RegisterResult(finalResult);

            if (debug)
                Console.WriteLine("{0} {1} return a {2}",LogTimestamp,receiver.NodeName.ToUpper(), finalResult.GetType().Name);

            destination.GetResult(finalResult);

            bool closeConnection = IsFinalInteraction(finalResult);
            if (closeConnection)
            {
                Console.WriteLine("{0} End of communication with client.",LogTimestamp);
                ((IClientChannel)destination).Close();
            }
        }
开发者ID:RSUDHAKARREDDI,项目名称:darpooling,代码行数:17,代码来源:DarPoolingService.cs

示例4: getresult

        bool getresult(Result r, out decimal result)
        {
            result = 0;
            if (resultproperty == null)
            {
                foreach (var pr in r.GetType().GetProperties())
                {
                    if (pr.Name == OptimizeDecisionsName)
                    {
                        resultproperty = pr;
                        break;
                    }
                }
            }
            try
            {
                var o = resultproperty.GetValue(r, null);
                result = (decimal)o;
                return true;
            }
            catch (Exception ex)
            {
                debug("error getting result from OptimizeDecision name: " + OptimizeDecisionsName + " err: " + ex.Message + ex.StackTrace);
            }
            return false;

        }
开发者ID:bluejack2000,项目名称:core,代码行数:27,代码来源:Optimize.cs

示例5: onResultReceive

 private void onResultReceive(Result result)
 {
     Type type = result.GetType();
     if (type == typeof(LoginOkResult) || type == typeof(RegisterOkResult))
         state = new JointState();
     else if (type == typeof(LoginErrorResult))
         ServiceProxy = null; // and state does not change
     // In practice, this is never used, since the core changes its state
     // right after it has sent the UnjoinCommand, without waiting confirmation
     else if (type == typeof(Communication.UnjoinConfirmedResult))
         state = new UnjointState();
 }
开发者ID:RSUDHAKARREDDI,项目名称:darpooling,代码行数:12,代码来源:UserNodeCore.cs

示例6: DisplayResults

 void DisplayResults(Result r)
 {
     CurrentResults = r;
     dt.BeginLoadData();
     dt.Clear();
     Type t = r.GetType();
     FieldInfo[] fis = t.GetFields();
     foreach (FieldInfo fi in fis)
     {
         string format = null;
         if (fi.FieldType == typeof(Decimal)) format = "{0:N2}";
         dt.Rows.Add(fi.Name, (format != null) ? string.Format(format, fi.GetValue(r)) : fi.GetValue(r).ToString());
     }
     PropertyInfo[] pis = t.GetProperties();
     foreach (PropertyInfo pi in pis)
     {
         if (pi.Name == "PerSymbolStats")
             continue;
         string format = null;
         if (pi.PropertyType == typeof(Decimal)) format = "{0:N2}";
         dt.Rows.Add(pi.Name, (format != null) ? string.Format(format, pi.GetValue(r, null)) : pi.GetValue(r, null).ToString());
     }
     foreach (string ps in r.PerSymbolStats)
     {
         string[] rs= ps.Split(':');
         if (rs.Length != 2) continue;
         dt.Rows.Add(rs[0], rs[1]);
     }
     dt.EndLoadData();
     refreshgrid();
 }
开发者ID:bluejack2000,项目名称:core,代码行数:31,代码来源:TradeResults.cs


注:本文中的System.Result.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。