Use file scoped namespace declarations

This commit is contained in:
Patrik Svensson
2021-12-21 11:06:46 +01:00
committed by Phil Scott
parent 1dbaf50935
commit ec1188b837
607 changed files with 28739 additions and 29245 deletions

View File

@ -1,30 +1,29 @@
using System.Collections.Generic;
namespace Spectre.Console.Examples
namespace Spectre.Console.Examples;
public static class Program
{
public static class Program
public static void Main()
{
public static void Main()
var cards = new List<Panel>();
foreach (var user in User.LoadUsers())
{
var cards = new List<Panel>();
foreach(var user in User.LoadUsers())
{
cards.Add(
new Panel(GetCardContent(user))
.Header($"{user.Country}")
.RoundedBorder().Expand());
}
// Render all cards in columns
AnsiConsole.Write(new Columns(cards));
cards.Add(
new Panel(GetCardContent(user))
.Header($"{user.Country}")
.RoundedBorder().Expand());
}
private static string GetCardContent(User user)
{
var name = $"{user.FirstName} {user.LastName}";
var city = $"{user.City}";
// Render all cards in columns
AnsiConsole.Write(new Columns(cards));
}
return $"[b]{name}[/]\n[yellow]{city}[/]";
}
private static string GetCardContent(User user)
{
var name = $"{user.FirstName} {user.LastName}";
var city = $"{user.City}";
return $"[b]{name}[/]\n[yellow]{city}[/]";
}
}

View File

@ -1,17 +1,17 @@
using System.Collections.Generic;
namespace Spectre.Console.Examples
{
public sealed class User
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string City { get; set; }
public string Country { get; set; }
namespace Spectre.Console.Examples;
public static List<User> LoadUsers()
{
return new List<User>
public sealed class User
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string City { get; set; }
public string Country { get; set; }
public static List<User> LoadUsers()
{
return new List<User>
{
new User
{
@ -84,6 +84,5 @@ namespace Spectre.Console.Examples
Country = "Ireland",
},
};
}
}
}