本文整理汇总了C#中IBus.GetAsyncResponse方法的典型用法代码示例。如果您正苦于以下问题:C# IBus.GetAsyncResponse方法的具体用法?C# IBus.GetAsyncResponse怎么用?C# IBus.GetAsyncResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBus
的用法示例。
在下文中一共展示了IBus.GetAsyncResponse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
using (bus = new Bus(@".\private$\testreq", @".\private$\", @".\private$\testack", null, null, null))
{
Console.WriteLine("Sending...");
var atoken = bus.Async<ARequest, AResponse>(new ARequest());
var btoken = bus.Async<BRequest, BResponse>(new BRequest());
var ctoken = bus.Async<CRequest, CResponse>(new CRequest());
var dtoken = bus.Async<DRequest, DResponse>(new DRequest());
Console.WriteLine("All Sent");
Console.WriteLine("Waiting");
while (true)
{
if (
!bus.IsReady<AResponse>(atoken) ||
!bus.IsReady<BResponse>(btoken) ||
!bus.IsReady<CResponse>(ctoken) ||
!bus.IsReady<DResponse>(dtoken))
{
Thread.Sleep(100);
Console.WriteLine("Waiting...");
}
}
var a = bus.GetAsyncResponse<AResponse>(atoken);
var b = bus.GetAsyncResponse<BResponse>(btoken);
var c = bus.GetAsyncResponse<CResponse>(ctoken);
var d = bus.GetAsyncResponse<DResponse>(dtoken);
Console.WriteLine("Completed.");
Console.ReadLine();
}
}