This file contains hidden or 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
var heroes = new Hero[] { | |
new("Homelander", "DC", true), | |
new("Jessica Jones", "Marvel", false), | |
}; | |
class Hero { | |
public Hero(string name, string universe, bool canFly) => | |
(Name, Universe, CanFly) = (name, universe, canFly); | |
public string Name { get; } |
This file contains hidden or 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 Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
var host = new HostBuilder() | |
.ConfigureServices((hostContext, services) => services.AddHostedService<ShutdownService>()) | |
.UseConsoleLifetime() | |
.Build(); |
This file contains hidden or 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
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env | |
WORKDIR /app | |
# Copy csproj and restore as distinct layers | |
COPY *.csproj ./ | |
RUN dotnet restore | |
# Copy everything else and build | |
COPY . ./ | |
RUN dotnet publish -o out |
This file contains hidden or 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.Threading.Tasks; | |
var tcs = new TaskCompletionSource(); | |
var sigintReceived = false; | |
Console.WriteLine("Waiting for SIGINT/SIGTERM"); | |
Console.CancelKeyPress += (_, ea) => | |
{ |
This file contains hidden or 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.Security.Claims; | |
using System.Text.Encodings.Web; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Authentication; | |
using Microsoft.AspNetCore.Authorization; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; |
This file contains hidden or 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
exports.add = function (x, y) { | |
return x + y; | |
} | |
exports.sub = function (x, y) { | |
return x - y; | |
} | |
exports.sumOfPositiveNumbers = function (upperLimitInclusive) { | |
let result = 0; |
NewerOlder