mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-08-02 18:17:30 +08:00
Remove verbs from extension methods
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.
This commit is contained in:

committed by
Patrik Svensson

parent
037a215a78
commit
041bd016a2
@ -19,8 +19,8 @@ namespace ColumnsExample
|
||||
var cards = new List<Panel>();
|
||||
foreach(var user in users.results)
|
||||
{
|
||||
cards.Add(new Panel(GetCard(user))
|
||||
.SetHeader($"{user.location.country}")
|
||||
cards.Add(new Panel(GetCardContent(user))
|
||||
.Header($"{user.location.country}")
|
||||
.RoundedBorder().Expand());
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ namespace ColumnsExample
|
||||
AnsiConsole.Render(new Columns(cards));
|
||||
}
|
||||
|
||||
private static string GetCard(dynamic user)
|
||||
private static string GetCardContent(dynamic user)
|
||||
{
|
||||
var name = $"{user.name.first} {user.name.last}";
|
||||
var country = $"{user.location.city}";
|
||||
|
Reference in New Issue
Block a user