本文整理汇总了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();
}
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
示例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();
}
示例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();
}