本文整理汇总了C#中DataStream.Start方法的典型用法代码示例。如果您正苦于以下问题:C# DataStream.Start方法的具体用法?C# DataStream.Start怎么用?C# DataStream.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStream
的用法示例。
在下文中一共展示了DataStream.Start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReceiveTest1
public void ReceiveTest1()
{
DataStream<int> dataStream = new DataStream<int>(()=>42,100);
dataStream.DataReceived += new EventHandler<EventArg<int>>(dataStream_DataReceived);
dataStream.Start();
int count = 0;
while (_DataReceivedValue==0 && count++<10)
{
Thread.Sleep(100);
}
Assert.AreEqual(42, _DataReceivedValue);
}
示例2: ErrorOccurredTest1
public void ErrorOccurredTest1()
{
DataStream<int> dataStream = new DataStream<int>(() => { throw new IOException(); }, 100);
dataStream.ErrorOccurred += new EventHandler<EventArg<Exception>>(dataStream_ErrorOccurred);
dataStream.Start();
int count = 0;
while (_ExceptionReceived == null && count++ < 10)
{
Thread.Sleep(100);
}
Assert.AreEqual(typeof(IOException), _ExceptionReceived.GetType());
}