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
| // MIT License: https://gist.github.com/saulm314/bf4c6cd9e4a9b045b52ad123a80a5c39 | |
| public readonly record struct Wrap<T>(T Value) | |
| { | |
| public static implicit operator Wrap<T>(T value) => new(value); | |
| public static implicit operator Wrap<T>?(T? value) => value is null ? null : new(value); | |
| } |
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
| // MIT License: https://gist.github.com/saulm314/91f0d83ce1a931b5086169e17b6e4eb0 | |
| using System; | |
| public abstract class JsonContentException(string? message) : Exception(message) | |
| { | |
| public class Empty() : JsonContentException("base JSON object { } not found"); | |
| public class PropertyNotFound(string path, string propertyName) | |
| : JsonContentException($"JSON property {path.Dereference(propertyName)} not found".AddPathWarning()) |
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
| // > dotnet run PngBackgroundRemover.cs | |
| // requires .NET SDK 10+ | |
| // MIT License: https://gist.github.com/saulm314/11e21fea1297693cd349734bc63c7a0a | |
| #:package BigGustave@1.0.6 | |
| using BigGustave; | |
| // configure these constants as required | |
| const string InputPngPath = "string-base.png"; |
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
| // > dotnet run PngBackgroundRemover.cs | |
| // requires .NET SDK 10+ | |
| // MIT License: https://gist.github.com/saulm314/985a47c7683d0cd9429f8a2938457562 | |
| #:package BigGustave@1.0.6 | |
| using BigGustave; | |
| // configure these constants as required | |
| const string InputPngPath = "string-base.png"; |