forked from dotnet/Open-XML-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCached.cs
More file actions
21 lines (17 loc) · 738 Bytes
/
Cached.cs
File metadata and controls
21 lines (17 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
namespace DocumentFormat.OpenXml.Framework
{
internal static class Cached
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T[] Array<T>() => System.Array.Empty<T>();
public static ReadOnlyCollection<T> ReadOnlyCollection<T>() => ReadOnlyCollectionCache<T>.Value;
private static class ReadOnlyCollectionCache<T>
{
internal static readonly ReadOnlyCollection<T> Value = new ReadOnlyCollection<T>(Array<T>());
}
}
}