Skip to content

Instantly share code, notes, and snippets.

View bwatts's full-sized avatar

Bryan Watts bwatts

View GitHub Profile
@bwatts
bwatts / Text.cs
Created January 28, 2023 20:35
I got annoyed checking if strings are null or whitespace in every message.
[JsonConverter(typeof(TextJsonConverter))]
[TypeConverter(typeof(TextTypeConverter))]
public sealed class Text : IEquatable<Text>, IEquatable<string>, IComparable<Text>, IComparable<string>
{
readonly string _value;
Text(string value) =>
_value = value;
public override string ToString() =>
@bwatts
bwatts / Id.cs
Created January 28, 2023 20:37
I got annoyed checking if GUIDs are empty in every message. Also, deterministic GUIDs are awesome.
[JsonConverter(typeof(IdJsonConverter))]
[TypeConverter(typeof(IdTypeConverter))]
public sealed class Id : IEquatable<Id>, IEquatable<Guid>, IComparable<Id>, IComparable<Guid>
{
readonly Guid _value;
Id(Guid value) =>
_value = value;
public override string ToString() =>