mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Removed the verbs from all extension methods that manipulate properties which makes the API more succinct and easier to read. Also added implicit conversion from string to Style. As a good OSS citizen, I've obsoleted the old methods with a warning for now, so this shouldn't break anyone using the old methods.
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
|
|
namespace Spectre.Console
|
|
{
|
|
/// <summary>
|
|
/// Contains extension methods for <see cref="IHasBoxBorder"/>.
|
|
/// </summary>
|
|
public static class ObsoleteHasBoxBorderExtensions
|
|
{
|
|
/// <summary>
|
|
/// Sets the border.
|
|
/// </summary>
|
|
/// <typeparam name="T">An object type with a border.</typeparam>
|
|
/// <param name="obj">The object to set the border for.</param>
|
|
/// <param name="border">The border to use.</param>
|
|
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
|
[Obsolete("Use Border(..) instead.")]
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
public static T SetBorder<T>(this T obj, BoxBorder border)
|
|
where T : class, IHasBoxBorder
|
|
{
|
|
if (obj is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(obj));
|
|
}
|
|
|
|
obj.Border = border;
|
|
return obj;
|
|
}
|
|
}
|
|
}
|