[英]Return value from wcf async call in Visual Studio 2010
I want to get the value from a wcf async call. 我想从wcf异步调用获取值。
public DateTime currentDateTime;
private void GetDateTime()
{
var client = new WcfClient();
client.GetCurrentDateTimeCompleted -= ClientGetCurrentDateTimeCompleted;
client.GetCurrentDateTimeCompleted += ClientGetCurrentDateTimeCompleted;
client.GetCurrentDateTimeAsync();
}
private void ClientGetCurrentDateTimeCompleted(object sender, GetCurrentDateTimeCompletedEventArgs args)
{
try
{
if (args.Error == null && args.Result != null)
{
currentDateTime = args.Result;
}
}
To call this method. 调用此方法。 I use
GetDateTime
. 我使用
GetDateTime
。 My question is the code didn't reach the method at all in the debug mode. 我的问题是代码在调试模式下根本没有达到方法。 The result time is
Date = {1/1/0001 12:00:00 AM}
. 结果时间是
Date = {1/1/0001 12:00:00 AM}
。
I know I call it synchronously. 我知道我叫它同步。 But how to get it in the debug model?
但是如何在调试模型中获取它呢?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.