mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Code cleanup
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
@@ -39,16 +38,6 @@ namespace ArchiSteamFarm {
|
||||
internal static class Utilities {
|
||||
private static readonly Random Random = new Random();
|
||||
|
||||
internal static IReadOnlyCollection<T> AsReadOnlyCollection<T>(this ICollection<T> source) {
|
||||
if (source == null) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(source));
|
||||
return null;
|
||||
}
|
||||
|
||||
IReadOnlyCollection<T> result = source as IReadOnlyCollection<T> ?? new ReadOnlyCollectionAdapter<T>(source);
|
||||
return result;
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "UnusedParameter.Global")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void Forget(this object obj) { }
|
||||
@@ -184,17 +173,5 @@ namespace ArchiSteamFarm {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private sealed class ReadOnlyCollectionAdapter<T> : IReadOnlyCollection<T> {
|
||||
public int Count => Source.Count;
|
||||
|
||||
private readonly ICollection<T> Source;
|
||||
|
||||
internal ReadOnlyCollectionAdapter(ICollection<T> source) => Source = source ?? throw new ArgumentNullException(nameof(source));
|
||||
|
||||
public IEnumerator<T> GetEnumerator() => Source.GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user