using System;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
namespace Cobilas.Collections.Generic {
/// Provides the base class for a read-only generic Long collection.
/// The type of elements in the collection.
[Serializable]
public class ReadOnlyLongCollection : ILongList, ILongList, IReadOnlyLongList, ICloneable {
private T[] readOnlyList;
[NonSerialized]
private object _syncRoot;
///
public long Count => ArrayManipulation.ArrayLongLength(readOnlyList);
bool ILongList.IsReadOnly => true;
bool ILongList.IsFixedSize => true;
bool ILongCollection.IsReadOnly => true;
bool ILongCollection.IsSynchronized => false;
object ILongCollection.SyncRoot {
get {
if (_syncRoot is null) {
if (readOnlyList is ICollection collection)
_syncRoot = collection.SyncRoot;
else Interlocked.CompareExchange