This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace DesignPatterns.Decorator | |
{ | |
public class ExtraLoudGigantosaurusDecorator : IGigantosaurus | |
{ | |
protected readonly IGigantosaurus gigantosaurus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace DesignPatterns.Decorator | |
{ | |
public class LoudGigantosarusDecorator : IGigantosaurus | |
{ | |
protected readonly IGigantosaurus gigantosaurus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace DesignPatterns.Decorator | |
{ | |
public class Gigantosaurus : IGigantosaurus | |
{ | |
public string Roar() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace DesignPatterns.Decorator | |
{ | |
public interface IGigantosaurus | |
{ | |
string Roar(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task<string?> GetStringAsync() | |
{ | |
await Task.Delay(1).ConfigureAwait(false); | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Thing | |
{ | |
private Thing(string aString) | |
{ | |
this.AString = aString; | |
} | |
public string AString { get; } | |
public static async Task<Thing> CreateThingAsync() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Thing | |
{ | |
public string AString { get; private set; } | |
public static async Task<Thing> CreateThingAsync() | |
{ | |
return new Thing() | |
{ | |
AString = await GetStringAsync() | |
}; |