Skip to content

Commit

Permalink
Introduced new "ReadOnlyCollection" and "ReadOnlyList" classes
Browse files Browse the repository at this point in the history
  • Loading branch information
abjerner committed Feb 5, 2024
1 parent e78b6ae commit d8ab691
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Skybrud.Essentials/Collections/ReadOnlyCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;

namespace Skybrud.Essentials.Collections;

/// <summary>
/// Static class for working with <see cref="IReadOnlyCollection{T}"/>.
/// </summary>
public static class ReadOnlyCollection {

/// <summary>
/// Returns an empty instance of <see cref="IReadOnlyCollection{T}"/>.
/// </summary>
/// <typeparam name="T">The item type of the collection.</typeparam>
/// <returns>An instance of <see cref="IReadOnlyCollection{T}"/>.</returns>
public static IReadOnlyCollection<T> Empty<T>() {
return ArrayUtils.Empty<T>();
}

}
19 changes: 19 additions & 0 deletions src/Skybrud.Essentials/Collections/ReadOnlyList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;

namespace Skybrud.Essentials.Collections;

/// <summary>
/// Static class for working with <see cref="IReadOnlyList{T}"/>.
/// </summary>
public static class ReadOnlyList {

/// <summary>
/// Returns an empty instance of <see cref="IReadOnlyList{T}"/>.
/// </summary>
/// <typeparam name="T">The item type of the list.</typeparam>
/// <returns>An instance of <see cref="IReadOnlyList{T}"/>.</returns>
public static IReadOnlyList<T> Empty<T>() {
return ArrayUtils.Empty<T>();
}

}

0 comments on commit d8ab691

Please sign in to comment.