13 [DebuggerTypeProxy(typeof(System_CollectionDebugView<>))]
14 [DebuggerDisplay(
"Count = {Count}")]
15 [global::__DynamicallyInvokable]
20 [global::__DynamicallyInvokable]
35 private const string LinkedListName =
"LinkedList";
37 private const string CurrentValueName =
"Current";
39 private const string VersionName =
"Version";
41 private const string IndexName =
"Index";
45 [global::__DynamicallyInvokable]
48 [global::__DynamicallyInvokable]
58 [global::__DynamicallyInvokable]
61 [global::__DynamicallyInvokable]
64 if (index == 0 || index == list.Count + 1)
75 version = list.version;
96 [global::__DynamicallyInvokable]
99 if (version != list.version)
105 index = list.Count + 1;
111 if (node == list.head)
120 [global::__DynamicallyInvokable]
123 if (version != list.version)
127 current =
default(
T);
133 [global::__DynamicallyInvokable]
149 info.AddValue(
"LinkedList", list);
150 info.AddValue(
"Version", version);
151 info.AddValue(
"Current", current);
152 info.AddValue(
"Index", index);
169 version = siInfo.
GetInt32(
"Version");
170 current = (
T)siInfo.
GetValue(
"Current", typeof(
T));
172 if (list.siInfo !=
null)
174 list.OnDeserialization(sender);
176 if (index == list.Count + 1)
183 if (node !=
null && index != 0)
185 for (
int i = 0; i < index; i++)
189 if (node == list.First)
203 internal int version;
205 private object _syncRoot;
209 private const string VersionName =
"Version";
211 private const string CountName =
"Count";
213 private const string ValuesName =
"Data";
217 [global::__DynamicallyInvokable]
220 [global::__DynamicallyInvokable]
229 [global::__DynamicallyInvokable]
232 [global::__DynamicallyInvokable]
241 [global::__DynamicallyInvokable]
244 [global::__DynamicallyInvokable]
258 [global::__DynamicallyInvokable]
261 [global::__DynamicallyInvokable]
271 [global::__DynamicallyInvokable]
274 [global::__DynamicallyInvokable]
283 [global::__DynamicallyInvokable]
284 object ICollection.SyncRoot
286 [global::__DynamicallyInvokable]
289 if (_syncRoot ==
null)
298 [global::__DynamicallyInvokable]
307 [global::__DynamicallyInvokable]
310 if (collection ==
null)
314 foreach (
T item
in collection)
330 [global::__DynamicallyInvokable]
344 [global::__DynamicallyInvokable]
349 InternalInsertNodeBefore(node.next, linkedListNode);
350 return linkedListNode;
362 [global::__DynamicallyInvokable]
366 ValidateNewNode(newNode);
367 InternalInsertNodeBefore(node.next, newNode);
379 [global::__DynamicallyInvokable]
384 InternalInsertNodeBefore(node, linkedListNode);
387 head = linkedListNode;
389 return linkedListNode;
401 [global::__DynamicallyInvokable]
405 ValidateNewNode(newNode);
406 InternalInsertNodeBefore(node, newNode);
417 [global::__DynamicallyInvokable]
423 InternalInsertNodeToEmptyList(linkedListNode);
427 InternalInsertNodeBefore(head, linkedListNode);
428 head = linkedListNode;
430 return linkedListNode;
439 [global::__DynamicallyInvokable]
442 ValidateNewNode(node);
445 InternalInsertNodeToEmptyList(node);
449 InternalInsertNodeBefore(head, node);
458 [global::__DynamicallyInvokable]
464 InternalInsertNodeToEmptyList(linkedListNode);
468 InternalInsertNodeBefore(head, linkedListNode);
470 return linkedListNode;
479 [global::__DynamicallyInvokable]
482 ValidateNewNode(node);
485 InternalInsertNodeToEmptyList(node);
489 InternalInsertNodeBefore(head, node);
495 [global::__DynamicallyInvokable]
503 linkedListNode.Invalidate();
514 [global::__DynamicallyInvokable]
517 return Find(value) !=
null;
528 [global::__DynamicallyInvokable]
535 if (index < 0 || index > array.Length)
539 if (array.Length - index <
Count)
548 array[index++] = next.item;
551 while (next != head);
558 [global::__DynamicallyInvokable]
569 if (@
default.Equals(next.item, value))
575 while (next != head);
581 if (next.item ==
null)
587 while (next != head);
596 [global::__DynamicallyInvokable]
606 if (linkedListNode !=
null)
612 if (@
default.Equals(linkedListNode.item, value))
614 return linkedListNode;
616 linkedListNode = linkedListNode.prev;
618 while (linkedListNode != prev);
624 if (linkedListNode.item ==
null)
626 return linkedListNode;
628 linkedListNode = linkedListNode.prev;
630 while (linkedListNode != prev);
638 [global::__DynamicallyInvokable]
641 return new Enumerator(
this);
646 [global::__DynamicallyInvokable]
656 [global::__DynamicallyInvokable]
660 if (linkedListNode !=
null)
662 InternalRemoveNode(linkedListNode);
674 [global::__DynamicallyInvokable]
678 InternalRemoveNode(node);
683 [global::__DynamicallyInvokable]
690 InternalRemoveNode(head);
695 [global::__DynamicallyInvokable]
702 InternalRemoveNode(head.prev);
717 info.AddValue(
"Version", version);
718 info.AddValue(
"Count", count);
723 info.AddValue(
"Data", array, typeof(
T[]));
736 int @
int = siInfo.
GetInt32(
"Version");
739 T[] array = (
T[])siInfo.
GetValue(
"Data", typeof(
T[]));
744 for (
int i = 0; i < array.Length; i++)
760 newNode.prev = node.prev;
761 node.prev.next = newNode;
767 private void InternalInsertNodeToEmptyList(LinkedListNode<T> newNode)
769 newNode.next = newNode;
770 newNode.prev = newNode;
776 internal void InternalRemoveNode(LinkedListNode<T> node)
778 if (node.next == node)
784 node.next.prev = node.prev;
785 node.prev.next = node.next;
796 internal void ValidateNewNode(LinkedListNode<T> node)
800 throw new ArgumentNullException(
"node");
802 if (node.list !=
null)
804 throw new InvalidOperationException(SR.GetString(
"LinkedListNodeIsAttached"));
808 internal void ValidateNode(LinkedListNode<T> node)
812 throw new ArgumentNullException(
"node");
814 if (node.list !=
this)
816 throw new InvalidOperationException(SR.GetString(
"ExternalLinkedListNode"));
830 [global::__DynamicallyInvokable]
831 void ICollection.CopyTo(Array array,
int index)
835 throw new ArgumentNullException(
"array");
839 throw new ArgumentException(SR.GetString(
"Arg_MultiRank"));
841 if (array.GetLowerBound(0) != 0)
843 throw new ArgumentException(SR.GetString(
"Arg_NonZeroLowerBound"));
847 throw new ArgumentOutOfRangeException(
"index", SR.GetString(
"IndexOutOfRange", index));
849 if (array.Length - index <
Count)
851 throw new ArgumentException(SR.GetString(
"Arg_InsufficientSpace"));
853 T[] array2 = array as
T[];
859 Type elementType = array.GetType().GetElementType();
860 Type typeFromHandle = typeof(T);
861 if (!elementType.IsAssignableFrom(typeFromHandle) && !typeFromHandle.IsAssignableFrom(elementType))
863 throw new ArgumentException(SR.GetString(
"Invalid_Array_Type"));
865 object[] array3 = array as
object[];
868 throw new ArgumentException(SR.GetString(
"Invalid_Array_Type"));
870 LinkedListNode<T> next = head;
877 array3[index++] = next.item;
880 while (next != head);
883 catch (ArrayTypeMismatchException)
885 throw new ArgumentException(SR.GetString(
"Invalid_Array_Type"));
891 [global::__DynamicallyInvokable]
892 IEnumerator IEnumerable.GetEnumerator()
LinkedListNode< T > Last
Gets the last node of the T:System.Collections.Generic.LinkedList`1.
LinkedList(SerializationInfo info, StreamingContext context)
Initializes a new instance of the T:System.Collections.Generic.LinkedList`1 class that is serializabl...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Describes a set of security permissions applied to code. This class cannot be inherited.
Provides a base class for implementations of the T:System.Collections.Generic.IEqualityComparer`1 gen...
Enumerator GetEnumerator()
Returns an enumerator that iterates through the T:System.Collections.Generic.LinkedList`1.
bool MoveNext()
Advances the enumerator to the next element of the T:System.Collections.Generic.LinkedList`1.
void Reset()
Sets the enumerator to its initial position, which is before the first element in the collection.
T Current
Gets the element at the current position of the enumerator.
virtual void OnDeserialization(object sender)
Implements the T:System.Runtime.Serialization.ISerializable interface and raises the deserialization ...
bool Remove(T value)
Removes the first occurrence of the specified value from the T:System.Collections....
LinkedListNode< T > AddFirst(T value)
Adds a new node containing the specified value at the start of the T:System.Collections....
Provides a mechanism for releasing unmanaged resources.To browse the .NET Framework source code for t...
Indicates that a class is to be notified when deserialization of the entire object graph has been com...
LinkedListNode< T > First
Gets the first node of the T:System.Collections.Generic.LinkedList`1.
new IEnumerator< T > GetEnumerator()
Returns an enumerator that iterates through the collection.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
LinkedListNode< T > AddLast(T value)
Adds a new node containing the specified value at the end of the T:System.Collections....
Exposes the enumerator, which supports a simple iteration over a collection of a specified type....
Represents a strongly-typed, read-only collection of elements.
LinkedList()
Initializes a new instance of the T:System.Collections.Generic.LinkedList`1 class that is empty.
Describes the source and destination of a given serialized stream, and provides an additional caller-...
LinkedListNode< T > Next
Gets the next node in the T:System.Collections.Generic.LinkedList`1.
static EqualityComparer< T > Default
Returns a default equality comparer for the type specified by the generic argument.
Supports a simple iteration over a generic collection.
Defines methods to manipulate generic collections.
int Count
Gets the number of nodes actually contained in the T:System.Collections.Generic.LinkedList`1.
LinkedListNode< T > Find(T value)
Finds the first node that contains the specified value.
Represents a node in a T:System.Collections.Generic.LinkedList`1. This class cannot be inherited.
SecurityAction
Specifies the security actions that can be performed using declarative security.
bool Contains(T value)
Determines whether a value is in the T:System.Collections.Generic.LinkedList`1.
void CopyTo(T[] array, int index)
Copies the entire T:System.Collections.Generic.LinkedList`1 to a compatible one-dimensional T:System....
void OnDeserialization(object sender)
Runs when the entire object graph has been deserialized.
static int CompareExchange(ref int location1, int value, int comparand)
Compares two 32-bit signed integers for equality and, if they are equal, replaces the first value.
void AddBefore(LinkedListNode< T > node, LinkedListNode< T > newNode)
Adds the specified new node before the specified existing node in the T:System.Collections....
bool IsSynchronized
Gets a value indicating whether access to the T:System.Collections.ICollection is synchronized (threa...
void Remove(LinkedListNode< T > node)
Removes the specified node from the T:System.Collections.Generic.LinkedList`1.
new T Current
Gets the element in the collection at the current position of the enumerator.
The exception thrown when an error occurs during serialization or deserialization.
void AddLast(LinkedListNode< T > node)
Adds the specified new node at the end of the T:System.Collections.Generic.LinkedList`1.
void Dispose()
Releases all resources used by the T:System.Collections.Generic.LinkedList`1.Enumerator.
LinkedListNode< T > AddBefore(LinkedListNode< T > node, T value)
Adds a new node containing the specified value before the specified existing node in the T:System....
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
Represents a doubly linked list.
LinkedList(IEnumerable< T > collection)
Initializes a new instance of the T:System.Collections.Generic.LinkedList`1 class that contains eleme...
The exception that is thrown when one of the arguments provided to a method is not valid.
void AddAfter(LinkedListNode< T > node, LinkedListNode< T > newNode)
Adds the specified new node after the specified existing node in the T:System.Collections....
void RemoveFirst()
Removes the node at the start of the T:System.Collections.Generic.LinkedList`1.
Allows an object to control its own serialization and deserialization.
LinkedListNode< T > AddAfter(LinkedListNode< T > node, T value)
Adds a new node containing the specified value after the specified existing node in the T:System....
Enumerates the elements of a T:System.Collections.Generic.LinkedList`1.
LinkedListNode< T > FindLast(T value)
Finds the last node that contains the specified value.
object GetValue(string name, Type type)
Retrieves a value from the T:System.Runtime.Serialization.SerializationInfo store.
Specifies that the class can be serialized.
void AddFirst(LinkedListNode< T > node)
Adds the specified new node at the start of the T:System.Collections.Generic.LinkedList`1.
The exception that is thrown when a method call is invalid for the object's current state.
int GetInt32(string name)
Retrieves a 32-bit signed integer value from the T:System.Runtime.Serialization.SerializationInfo sto...
SecurityPermissionFlag
Specifies access flags for the security permission object.
void GetObjectData(SerializationInfo info, StreamingContext context)
Populates a T:System.Runtime.Serialization.SerializationInfo with the data needed to serialize the ta...
Provides atomic operations for variables that are shared by multiple threads.
virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Implements the T:System.Runtime.Serialization.ISerializable interface and returns the data needed to ...
void RemoveLast()
Removes the node at the end of the T:System.Collections.Generic.LinkedList`1.
void Clear()
Removes all nodes from the T:System.Collections.Generic.LinkedList`1.