1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:38:47 +00:00

Accept nullable value for AsArray/AsEnumerable

This commit is contained in:
Oliver Booth 2022-04-22 09:30:55 +01:00
parent a5df7a9ee8
commit fde9413681
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -1,4 +1,4 @@
namespace X10D.Core;
namespace X10D.Core;
/// <summary>
/// Extension methods which apply to all types.
@ -13,7 +13,7 @@ public static class Extensions
/// <returns>
/// An array of type <typeparamref name="T" /> with length 1, whose only element is <paramref name="value" />.
/// </returns>
public static T[] AsArray<T>(this T value)
public static T?[] AsArray<T>(this T? value)
{
return new[] {value};
}
@ -26,7 +26,7 @@ public static class Extensions
/// <returns>
/// An enumerable collection of type <typeparamref name="T" />, whose only element is <paramref name="value" />.
/// </returns>
public static IEnumerable<T> AsEnumerable<T>(this T value)
public static IEnumerable<T?> AsEnumerable<T>(this T? value)
{
yield return value;
}