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
[GeneratedRegex(@"\{(\d+)\}")] | |
private static partial Regex FormattableStringArgumentRegex(); | |
/// <summary> | |
/// Extension method for combining two <see cref="FormattableString"/>, and returning a new <see cref="FormattableString"/> with the combined arguments and format | |
/// </summary> | |
/// <remarks>Originally added to facilitate dynamically building up querystrings that EFCore would take and excute</remarks> | |
public static FormattableString Combine(this FormattableString baseFormattableString, FormattableString addingFormattableString) | |
{ | |
var regex = FormattableStringArgumentRegex(); |
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
public static partial class ExtensionMethods | |
{ | |
public static bool IsNullOrDefault<T>([NotNullWhen(false)] this T? value) where T : struct | |
{ | |
//return value == null || value.Equals(default(T)); Simpler, but my research online recommended using EqualityComparer<T>.Default instead of value.Equals | |
return !value.HasValue || EqualityComparer<T>.Default.Equals(value.Value, default); | |
} | |
} |
OlderNewer