Skip to content

Instantly share code, notes, and snippets.

@georgekosmidis
Last active November 29, 2021 09:49
Show Gist options
  • Select an option

  • Save georgekosmidis/002c3a36dcaf3c2acc51ee19ddf43ba5 to your computer and use it in GitHub Desktop.

Select an option

Save georgekosmidis/002c3a36dcaf3c2acc51ee19ddf43ba5 to your computer and use it in GitHub Desktop.
var bytes = new Span<byte>(new byte[256]); //arbitrary number
if (Convert.TryFromBase64String("YOUR_BASE64_STRING_HERE", bytes, out int bytesWritten))
{
var guidDecoded = new Guid(bytes.Slice(0, bytesWritten).ToArray()).ToString();
}
var base64Encoded = Convert.ToBase64String("YOUR_GUID_HERE");
public class PriceSet
{
[BsonId]
public Guid Id { get; init set; }
public decimal Price { get; init set; }
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment