The contents of a repeated field: essentially, a collection with some extra restrictions (no null values) and capabilities (deep cloning).
This implementation does not generally prohibit the use of types which are not supported by Protocol Buffers but nor does it guarantee that all operations will work in such cases.
Details | |||
---|---|---|---|
Template Parameters |
|
Public attributes |
|
---|---|
Count => count
|
int
Gets the number of elements contained in the collection.
|
IsReadOnly => false
|
bool
Gets a value indicating whether the collection is read-only.
|
Properties |
|
---|---|
this[int index]
|
T
Gets or sets the item at the specified index.
|
this[int index]
|
object IList.
|
Public functions |
|
---|---|
Add(T item)
|
void
Adds the specified item to the collection.
|
Add(IEnumerable< T > values)
|
void
Adds all of the specified values into this collection.
|
AddEntriesFrom(CodedInputStream input, FieldCodec< T > codec)
|
void
Adds the entries from the given input stream, decoding them with the specified codec.
|
AddRange(IEnumerable< T > values)
|
void
Adds all of the specified values into this collection.
|
CalculateSize(FieldCodec< T > codec)
|
int
Calculates the size of this collection based on the given codec.
|
Clear()
|
void
Removes all items from the collection.
|
Clone()
|
RepeatedField< T >
Creates a deep clone of this repeated field.
|
Contains(T item)
|
bool
Determines whether this collection contains the given item.
|
CopyTo(T[] array, int arrayIndex)
|
void
Copies this collection to the given array.
|
Equals(object obj)
|
override bool
Determines whether the specified System.Object, is equal to this instance.
|
Equals(RepeatedField< T > other)
|
bool
Compares this repeated field with another for equality.
|
GetEnumerator()
|
IEnumerator< T >
Returns an enumerator that iterates through the collection.
|
GetHashCode()
|
override int
Returns a hash code for this instance.
|
IndexOf(T item)
|
int
Returns the index of the given item within the collection, or -1 if the item is not present.
|
Insert(int index, T item)
|
void
Inserts the given item at the specified index.
|
Remove(T item)
|
bool
Removes the specified item from the collection
|
RemoveAt(int index)
|
void
Removes the item at the given index.
|
ToString()
|
override string
Returns a string representation of this repeated field, in the same way as it would be represented by the default JSON formatter.
|
WriteTo(CodedOutputStream output, FieldCodec< T > codec)
|
void
Writes the contents of this collection to the given CodedOutputStream, encoding each value using the specified codec.
|
int Count => count
Gets the number of elements contained in the collection.
bool IsReadOnly => false
Gets a value indicating whether the collection is read-only.
T this[int index]
Gets or sets the item at the specified index.
The element at the specified index.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The item at the specified index.
|
object IList. this[int index]
void Add( T item )
Adds the specified item to the collection.
Details | |||
---|---|---|---|
Parameters |
|
void Add( IEnumerable< T > values )
Adds all of the specified values into this collection.
This method is present to allow repeated fields to be constructed from queries within collection initializers. Within non-collection-initializer code, consider using the equivalent AddRange method instead for clarity.
Details | |||
---|---|---|---|
Parameters |
|
void AddEntriesFrom( CodedInputStream input, FieldCodec< T > codec )
Adds the entries from the given input stream, decoding them with the specified codec.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
void AddRange( IEnumerable< T > values )
Adds all of the specified values into this collection.
Details | |||
---|---|---|---|
Parameters |
|
int CalculateSize( FieldCodec< T > codec )
Calculates the size of this collection based on the given codec.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The number of bytes that would be written to a CodedOutputStream by WriteTo, using the same codec.
|
void Clear()
Removes all items from the collection.
RepeatedField< T > Clone()
Creates a deep clone of this repeated field.
If the field type is a message type, each element is also cloned; otherwise, it is assumed that the field type is primitive (including string and bytes, both of which are immutable) and so a simple copy is equivalent to a deep clone.
Details | |
---|---|
Returns |
A deep clone of this repeated field.
|
bool Contains( T item )
Determines whether this collection contains the given item.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
true if this collection contains the given item; false otherwise. |
void CopyTo( T[] array, int arrayIndex )
Copies this collection to the given array.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
override bool Equals( object obj )
Determines whether the specified System.Object, is equal to this instance.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
true if the specified System.Object is equal to this instance; otherwise, false . |
bool Equals( RepeatedField< T > other )
Compares this repeated field with another for equality.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
true if other refers to an equal repeated field; false otherwise. |
IEnumerator< T > GetEnumerator()
Returns an enumerator that iterates through the collection.
Details | |
---|---|
Returns |
An enumerator that can be used to iterate through the collection.
|
override int GetHashCode()
Returns a hash code for this instance.
Details | |
---|---|
Returns |
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
|
int IndexOf( T item )
Returns the index of the given item within the collection, or -1 if the item is not present.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The zero-based index of the item, or -1 if it is not found.
|
void Insert( int index, T item )
Inserts the given item at the specified index.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
bool Remove( T item )
Removes the specified item from the collection
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
true if the item was found and removed; false otherwise. |
void RemoveAt( int index )
Removes the item at the given index.
Details | |||
---|---|---|---|
Parameters |
|
override string ToString()
Returns a string representation of this repeated field, in the same way as it would be represented by the default JSON formatter.
void WriteTo( CodedOutputStream output, FieldCodec< T > codec )
Writes the contents of this collection to the given CodedOutputStream, encoding each value using the specified codec.
Details | |||||
---|---|---|---|---|---|
Parameters |
|