예제 #1
0
        public static bool TryReadAt <T>(this Concurrent <T[]> concurrent, int index, out T value)
        {
            using var read = concurrent.Read();
            if (index < read.Value.Length)
            {
                value = read.Value[index];
                return(true);
            }

            value = default;
            return(false);
        }
예제 #2
0
 public static T[] ReadToArray <T>(this Concurrent <List <T> > concurrent)
 {
     using var read = concurrent.Read();
     return(read.Value.ToArray());
 }
예제 #3
0
 public static T ReadAt <T>(this Concurrent <T[]> concurrent, int index)
 {
     using var read = concurrent.Read();
     return(read.Value[index]);
 }
예제 #4
0
 public static int ReadCount <T>(this Concurrent <T> concurrent) where T : ICollection
 {
     using var read = concurrent.Read();
     return(read.Value.Count);
 }