-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPrintTask.cs
30 lines (25 loc) · 858 Bytes
/
PrintTask.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) Jacob Viau. All rights reserved.
// Licensed under the APACHE 2.0. See LICENSE file in the project root for full license information.
using DurableTask.Core;
namespace DurableTask.Samples;
/// <summary>
/// An activity to print to the console.
/// </summary>
public class PrintTask : TaskActivity<string, string>
{
private readonly IConsole _console;
/// <summary>
/// Initializes a new instance of the <see cref="PrintTask"/> class.
/// </summary>
/// <param name="console">The console to print to.</param>
public PrintTask(IConsole console)
{
_console = console ?? throw new ArgumentNullException(nameof(console));
}
/// <inheritdoc />
protected override string Execute(TaskContext context, string input)
{
_console.WriteLine(input);
return string.Empty;
}
}