dotnet-installer/src/Microsoft.DotNet.Cli.Utils/CollectionsExtensions.cs

19 lines
545 B
C#
Raw Normal View History

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.DotNet.Cli.Utils
{
public static class CollectionsExtensions
{
public static IEnumerable<T> OrEmptyIfNull<T>(this IEnumerable<T> enumerable)
{
return enumerable == null
? Enumerable.Empty<T>()
: enumerable;
}
}
}