Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ConsoleInReadCharacter.cs
1using System;
2using System.Threading;
3using System.Threading.Tasks;
5
7{
12 {
13 private readonly TaskCompletionSource<int> result;
14
19 public ConsoleInReadCharacter(TaskCompletionSource<int> Result)
20 {
21 this.result = Result;
22 }
23
28 public override Task Execute(CancellationToken Cancel)
29 {
30 try
31 {
32 int Result = System.Console.In.Read();
33 this.result.TrySetResult(Result);
34 }
35 catch (Exception ex)
36 {
37 this.result.TrySetException(ex);
38 }
39
40 return Task.CompletedTask;
41 }
42 }
43}
ConsoleInReadCharacter(TaskCompletionSource< int > Result)
Reads a character from the console.
override Task Execute(CancellationToken Cancel)
Executes the console operation.
Represents an asynchronous operation to be performed.
Definition: WorkItem.cs:10