Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ConsoleInRead.cs
1using System;
2using System.Threading.Tasks;
3
5{
9 public class ConsoleInRead : WorkItem
10 {
11 private readonly TaskCompletionSource<int> result;
12 private readonly char[] buffer;
13 private readonly int index;
14 private readonly int count;
15
29 public ConsoleInRead(char[] Buffer, int Index, int Count, TaskCompletionSource<int> Result)
30 {
31 this.buffer = Buffer;
32 this.index = Index;
33 this.count = Count;
34 this.result = Result;
35 }
36
40 public override async Task Execute()
41 {
42 try
43 {
44 int Result = await System.Console.In.ReadAsync(this.buffer, this.index, this.count);
45 this.result.TrySetResult(Result);
46 }
47 catch (Exception ex)
48 {
49 this.result.TrySetException(ex);
50 }
51 }
52 }
53}
Reads characters from the console.
override async Task Execute()
Executes the console operation.
ConsoleInRead(char[] Buffer, int Index, int Count, TaskCompletionSource< int > Result)
Reads characters from the console.
Manages a Console operation.
Definition: WorkItem.cs:9