This article has moved to the official .NET Docs site.
See https://docs.microsoft.com/dotnet/standard/base-types/character-encoding-introduction.
static string compressGuid(Guid guid) | |
{ | |
// "MspzuC2oLkKjoUEgZrbJFg==" | |
return Convert.ToBase64String(guid.ToByteArray()) | |
.Substring(0, 22) | |
.Replace('+', '-') | |
.Replace('/', '_'); | |
} |
This article has moved to the official .NET Docs site.
See https://docs.microsoft.com/dotnet/standard/base-types/character-encoding-introduction.
I was playing with new .Net 5 and the Source Generator lately and got an idea that it is possible to add "duck typing" support to C#. I would say it is purely academic(no one will use it in production I hope), but it is fun stuff so I decided to try.
The nuget package with results you can find here
The repository is here: https://github.com/byme8/DuckInterface