mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00
Make it possible to set Value directly
This commit is contained in:

committed by
Patrik Svensson

parent
3a42c0a119
commit
c64884854f
@ -40,5 +40,22 @@ namespace Spectre.Console
|
||||
task.MaxValue = value;
|
||||
return task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the value of the task.
|
||||
/// </summary>
|
||||
/// <param name="task">The task.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static ProgressTask Value(this ProgressTask task, double value)
|
||||
{
|
||||
if (task is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(task));
|
||||
}
|
||||
|
||||
task.Value = value;
|
||||
return task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user