• Home
  • Raw
  • Download

Lines Matching +full:copy +full:- +full:item

2 // Protocol Buffers - Google's data interchange format
4 // https://developers.google.com/protocol-buffers/
70 /// bytes, both of which are immutable) and so a simple copy is
123 // Non-nullable value types can be packed or not. in AddEntriesFrom()
132 // of the repeated field and pre-initialize the underlying collection. in AddEntriesFrom()
158 // Empty packed field. Odd, but valid - just ignore. in AddEntriesFrom()
288 …/// <exception cref="ArgumentOutOfRangeException">The new value is less than Count -or- when Count…
298 … $"Cannot set Capacity to a value smaller than the current item count, {count}");
325 Array.Copy(array, 0, tmp, 0, count); in SetSize()
331 /// Adds the specified item to the collection.
333 /// <param name="item">The item to add.</param>
334 public void Add(T item) in Add() argument
336 ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); in Add()
338 array[count++] = item; in Add()
351 /// Determines whether this collection contains the given item.
353 /// <param name="item">The item to find.</param>
354 …/// <returns><c>true</c> if this collection contains the given item; <c>false</c> otherwise.</retu…
355 public bool Contains(T item) in Contains() argument
357 return IndexOf(item) != -1; in Contains()
363 /// <param name="array">The array to copy to.</param>
364 /// <param name="arrayIndex">The first index of the array to copy to.</param>
367 Array.Copy(this.array, 0, array, arrayIndex, count); in CopyTo()
371 /// Removes the specified item from the collection
373 /// <param name="item">The item to remove.</param>
374 … /// <returns><c>true</c> if the item was found and removed; <c>false</c> otherwise.</returns>
375 public bool Remove(T item) in Remove() argument
377 int index = IndexOf(item); in Remove()
378 if (index == -1) in Remove()
382 Array.Copy(array, index + 1, array, index, count - index - 1); in Remove()
383 count--; in Remove()
394 /// Gets a value indicating whether the collection is read-only.
412 Array.Copy(otherRepeatedField.array, 0, array, count, otherRepeatedField.count); in AddRange()
418 // just once and ask the collection to copy itself into the array. in AddRange()
424 … // present. (This isn't a thread-safe approach, but we don't advertise this is thread-safe.) in AddRange()
429 … // TODO: Measure whether iterating once to check and then letting the collection copy in AddRange()
432 // copy may be significantly faster than doing it one at a time. in AddRange()
433 foreach (var item in collection) in AddRange()
435 if (item == null) in AddRange()
451 foreach (T item in values) in AddRange()
453 Add(item); in AddRange()
460 … /// Within non-collection-initializer code, consider using the equivalent <see cref="AddRange"/>
553 /// Returns the index of the given item within the collection, or -1 if the item is not
556 /// <param name="item">The item to find in the collection.</param>
557 /// <returns>The zero-based index of the item, or -1 if it is not found.</returns>
558 public int IndexOf(T item) in IndexOf() argument
560 ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); in IndexOf()
564 if (comparer.Equals(array[i], item)) in IndexOf()
569 return -1; in IndexOf()
573 /// Inserts the given item at the specified index.
575 /// <param name="index">The index at which to insert the item.</param>
576 /// <param name="item">The item to insert.</param>
577 public void Insert(int index, T item) in Insert() argument
579 ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); in Insert()
585 Array.Copy(array, index, array, index + 1, count - index); in Insert()
586 array[index] = item; in Insert()
591 /// Removes the item at the given index.
593 /// <param name="index">The zero-based index of the item to remove.</param>
600 Array.Copy(array, index + 1, array, index, count - index - 1); in RemoveAt()
601 count--; in RemoveAt()
617 /// Gets or sets the item at the specified index.
622 /// <param name="index">The zero-based index of the element to get or set.</param>
623 /// <returns>The item at the specified index.</returns>
650 Array.Copy(this.array, 0, array, index, count); in ICollection.CopyTo()
666 return count - 1; in IList.Add()
678 return -1; in IList.IndexOf()