Skip to content

Commit

Permalink
Add the 'EmptyRefs' helper, to support Array.Empty on .NET 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Numpsy committed Feb 14, 2021
1 parent c814877 commit f869bed
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/ICSharpCode.SharpZipLib/Core/EmptyRefs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;

namespace ICSharpCode.SharpZipLib.Core
{
internal static class Empty
{
#if NET45
internal static class EmptyArray<T>
{
public static readonly T[] Value = new T[0];
}
public static T[] Array<T>() => EmptyArray<T>.Value;
#else
public static T[] Array<T>() => System.Array.Empty<T>();
#endif
}
}

0 comments on commit f869bed

Please sign in to comment.