Skip to content

Instantly share code, notes, and snippets.

View akiraveliara's full-sized avatar

Livia-Valeriya Silvercrown akiraveliara

  • Europe
  • 11:54 (UTC +01:00)
View GitHub Profile
@akiraveliara
akiraveliara / OptionalParameter.cs
Created March 11, 2022 11:55
why do nullable optional params exist
using System;
/// <summary>
/// Represents an optional parameter; ie a parameter which may or may not be sent to Discord.
/// Normally this problem is handled using <c>[JsonIgnore(Condition = JsonIgnoreCondition.IgnoreWhenNull)]</c>,
/// but this is unfortunately not always possible.
/// </summary>
/// <typeparam name="TParam">Any nullable parameter type.</typeparam>
public struct OptionalParameter<TParam>
{