Example #1
0
		public void Add(PhysicalLine line) {
			if (isDisposed)
				throw new ObjectDisposedException(nameof(PhysicalLineCache));
			if (line == null)
				throw new ArgumentNullException(nameof(line));
			if (cache.Count == maxCacheSize) {
				const int oldestIndex = 0;
				var oldest = cache[oldestIndex];
				oldest.Dispose();
				cache.RemoveAt(oldestIndex);
			}
			cache.Add(line);
		}
Example #2
0
 public void Add(PhysicalLine line)
 {
     if (isDisposed)
     {
         throw new ObjectDisposedException(nameof(PhysicalLineCache));
     }
     if (line == null)
     {
         throw new ArgumentNullException(nameof(line));
     }
     if (cache.Count == maxCacheSize)
     {
         const int oldestIndex = 0;
         var       oldest      = cache[oldestIndex];
         oldest.Dispose();
         cache.RemoveAt(oldestIndex);
     }
     cache.Add(line);
 }