Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Text;
namespace DesignPatterns.Decorator
{
public class ExtraLoudGigantosaurusDecorator : IGigantosaurus
{
protected readonly IGigantosaurus gigantosaurus;
using System;
using System.Collections.Generic;
using System.Text;
namespace DesignPatterns.Decorator
{
public class LoudGigantosarusDecorator : IGigantosaurus
{
protected readonly IGigantosaurus gigantosaurus;
using System;
using System.Collections.Generic;
using System.Text;
namespace DesignPatterns.Decorator
{
public class Gigantosaurus : IGigantosaurus
{
public string Roar()
{
using System;
using System.Collections.Generic;
using System.Text;
namespace DesignPatterns.Decorator
{
public interface IGigantosaurus
{
string Roar();
}
internal static class Program
{
/// <summary>
/// The entry point for the program.
/// </summary>
/// <param name="args">The arguments.</param>
/// <returns>When complete, an integer representing success (0) or failure (non-0).</returns>
public static async Task<int> Main(string[] args)
{
ServiceProvider serviceProvider = BuildServiceProvider();
public static class CliCommandCollectionExtensions
{
public static IServiceCollection AddCliCommands(this IServiceCollection services)
{
Type greetCommandType = typeof(DeployCommand);
Type commandType = typeof(Command);
IEnumerable<Type> commands = greetCommandType
.Assembly
.GetExportedTypes()
public class GreetCommand : Command
{
private readonly GreetOptions options;
public GreetCommand(GreetOptions options)
: base("greet", "Says a greeting to the specified person.")
{
var name = new Option<string>("--name")
{
Name = "name",
public static async Task<string?> GetStringAsync()
{
await Task.Delay(1).ConfigureAwait(false);
return null;
}
public class Thing
{
private Thing(string aString)
{
this.AString = aString;
}
public string AString { get; }
public static async Task<Thing> CreateThingAsync()
public class Thing
{
public string AString { get; private set; }
public static async Task<Thing> CreateThingAsync()
{
return new Thing()
{
AString = await GetStringAsync()
};