Добавление IDisposable

This commit is contained in:
2025-02-23 10:18:38 +03:00
parent b6226b68c9
commit ae4979c9f9
12 changed files with 207 additions and 72 deletions
+15 -1
View File
@@ -31,7 +31,21 @@ namespace Example.Backend
public async Task AsyncTest(CancellationToken token)
{
await Task.Delay(TimeSpan.FromSeconds(5), token);
Console.WriteLine("Async Test");
for (int i = 0; i < 10; i++)
{
if (token.IsCancellationRequested)
{
Console.WriteLine("Waiting canceled");
return;
}
Console.WriteLine("Waiting...");
await Task.Delay(1000);
}
Console.WriteLine("Waited until the end");
}
}
}
+6
View File
@@ -1,3 +1,4 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Example.Shared;
@@ -18,5 +19,10 @@ namespace Example.Backend
// throw new Exception("The method or operation is not implemented.");
return new Page {Text = text};
}
public void Dispose()
{
Console.WriteLine("Dispose printer with name {0}", Name);
}
}
}