diff --git a/xml/System.Collections.Generic/Dictionary`2+KeyCollection.xml b/xml/System.Collections.Generic/Dictionary`2+KeyCollection.xml
index 2e03996a6ac..ae3ba09ec7b 100644
--- a/xml/System.Collections.Generic/Dictionary`2+KeyCollection.xml
+++ b/xml/System.Collections.Generic/Dictionary`2+KeyCollection.xml
@@ -98,17 +98,17 @@
Represents the collection of keys in a . This class cannot be inherited.
- property returns an instance of this type, containing all the keys in that . The order of the keys in the is unspecified, but it is the same order as the associated values in the returned by the property.
-
- The is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the continue to be reflected in the .
-
+ property returns an instance of this type, containing all the keys in that . The order of the keys in the is unspecified, but it is the same order as the associated values in the returned by the property.
+
+ The is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the continue to be reflected in the .
+
]]>
- Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
-
+ Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
+
A can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
@@ -152,13 +152,13 @@
The whose keys are reflected in the new .
Initializes a new instance of the class that reflects the keys in the specified .
- is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the continue to be reflected in the .
-
- This constructor is an O(1) operation.
-
+ is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the continue to be reflected in the .
+
+ This constructor is an O(1) operation.
+
]]>
@@ -244,13 +244,13 @@
The zero-based index in at which copying begins.
Copies the elements to an existing one-dimensional , starting at the specified array index.
- in the same order in which the enumerator iterates through the .
-
- This method is an O(`n`) operation, where `n` is .
-
+ in the same order in which the enumerator iterates through the .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -304,8 +304,8 @@
Gets the number of elements contained in the .
- The number of elements contained in the .
-
+ The number of elements contained in the .
+
Retrieving the value of this property is an O(1) operation.
To be added.
@@ -351,29 +351,29 @@
Returns an enumerator that iterates through the .
A for the .
- is undefined. You must call to advance the enumerator to the first element of the collection before reading the value of .
-
- returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
+ is undefined. You must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding elements or changing the capacity, the enumerator is irrecoverably invalidated and the next call to or throws an .
.NET Core 3.0+ only: The only mutating methods which do not invalidate enumerators are and .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
]]>
@@ -473,11 +473,11 @@
Removes all items from the . This implementation always throws .
- is set to zero, and references to other objects from elements of the collection are also released.
-
+ is set to zero, and references to other objects from elements of the collection are also released.
+
]]>
Always thrown.
@@ -529,13 +529,13 @@
if is found in the ; otherwise, .
- uses , whereas, allows the user to specify the implementation to use for comparing keys.
-
- This method is an O(1) operation.
-
+ uses , whereas, allows the user to specify the implementation to use for comparing keys.
+
+ This method is an O(1) operation.
+
]]>
@@ -584,13 +584,13 @@
if the is read-only; otherwise, . In the default implementation of , this property always returns .
-
@@ -643,11 +643,11 @@
if was successfully removed from the ; otherwise, . This method also returns if item was not found in the original .
- uses , whereas, allows the user to specify the implementation to use for comparing keys.
-
+ uses , whereas, allows the user to specify the implementation to use for comparing keys.
+
]]>
Always thrown.
@@ -698,29 +698,29 @@
Returns an enumerator that iterates through a collection.
An that can be used to iterate through the collection.
- is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
-
- returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
+ is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding elements or changing the capacity, the enumerator is irrecoverably invalidated and the next call to or throws an .
.NET Core 3.0+ only: The only mutating methods which do not invalidate enumerators are and .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
]]>
@@ -774,15 +774,15 @@
The zero-based index in at which copying begins.
Copies the elements of the to an , starting at a particular index.
- [!NOTE]
-> If the type of the source cannot be cast automatically to the type of the destination `array`, the non-generic implementations of throw , whereas the generic implementations throw .
-
- This method is an O(`n`) operation, where `n` is .
-
+> If the type of the source cannot be cast automatically to the type of the destination `array`, the non-generic implementations of throw , whereas the generic implementations throw .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -790,18 +790,18 @@
is less than zero.
- is multidimensional.
-
- -or-
-
- does not have zero-based indexing.
-
- -or-
-
- The number of elements in the source is greater than the available space from to the end of the destination .
-
- -or-
-
+ is multidimensional.
+
+ -or-
+
+ does not have zero-based indexing.
+
+ -or-
+
+ The number of elements in the source is greater than the available space from to the end of the destination .
+
+ -or-
+
The type of the source cannot be cast automatically to the type of the destination .
@@ -851,17 +851,17 @@
if access to the is synchronized (thread safe); otherwise, . In the default implementation of , this property always returns .
- are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection.
-
- Retrieving the value of this property is an O(1) operation.
-
+ are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection.
+
+ Retrieving the value of this property is an O(1) operation.
+
]]>
@@ -916,42 +916,31 @@
Gets an object that can be used to synchronize access to the .
An object that can be used to synchronize access to the . In the default implementation of , this property always returns the current instance.
- are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
-
-```csharp
-ICollection ic = ...;
-lock (ic.SyncRoot) {
- // Access the collection.
-}
-```
-
-```vb
-Dim ic As ICollection = ...
-SyncLock ic.SyncRoot
- ' Access the collection.
-End SyncLock
-```
-
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Retrieving the value of this property is an O(1) operation.
-
+ are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
+
+```csharp
+ICollection ic = ...;
+lock (ic.SyncRoot) {
+ // Access the collection.
+}
+```
+
+```vb
+Dim ic As ICollection = ...
+SyncLock ic.SyncRoot
+ ' Access the collection.
+End SyncLock
+```
+
+Retrieving the value of this property is an O(1) operation.
+
]]>
@@ -1001,29 +990,29 @@ finally {
Returns an enumerator that iterates through a collection.
An that can be used to iterate through the collection.
- also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
-
- returns the same object until either or is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
-
+ also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ returns the same object until either or is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
+
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding elements or changing the capacity, the enumerator is irrecoverably invalidated and the next call to or throws an .
.NET Core 3.0+ only: The only mutating methods which do not invalidate enumerators are and .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
]]>
diff --git a/xml/System.Collections.Generic/Dictionary`2+ValueCollection.xml b/xml/System.Collections.Generic/Dictionary`2+ValueCollection.xml
index e44fe3a6317..a2320f792d1 100644
--- a/xml/System.Collections.Generic/Dictionary`2+ValueCollection.xml
+++ b/xml/System.Collections.Generic/Dictionary`2+ValueCollection.xml
@@ -98,17 +98,17 @@
Represents the collection of values in a . This class cannot be inherited.
- property returns an instance of this type, containing all the values in that . The order of the values in the is unspecified, but it is the same order as the associated keys in the returned by the property.
-
- The is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the continue to be reflected in the .
-
+ property returns an instance of this type, containing all the values in that . The order of the values in the is unspecified, but it is the same order as the associated keys in the returned by the property.
+
+ The is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the continue to be reflected in the .
+
]]>
- Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
-
+ Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
+
A can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
@@ -152,13 +152,13 @@
The whose values are reflected in the new .
Initializes a new instance of the class that reflects the values in the specified .
- is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the continue to be reflected in the .
-
- This constructor is an O(1) operation.
-
+ is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the continue to be reflected in the .
+
+ This constructor is an O(1) operation.
+
]]>
@@ -213,13 +213,13 @@
The zero-based index in at which copying begins.
Copies the elements to an existing one-dimensional , starting at the specified array index.
- in the same order in which the enumerator iterates through the .
-
- This method is an O(`n`) operation, where `n` is .
-
+ in the same order in which the enumerator iterates through the .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -275,11 +275,11 @@
Gets the number of elements contained in the .
The number of elements contained in the .
-
@@ -325,29 +325,29 @@
Returns an enumerator that iterates through the .
A for the .
- is undefined. You must call to advance the enumerator to the first element of the collection before reading the value of .
-
- The returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
+ is undefined. You must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ The returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding elements or changing the capacity, the enumerator is irrecoverably invalidated and the next call to or throws an .
.NET Core 3.0+ only: The only mutating methods which do not invalidate enumerators are and .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
]]>
@@ -447,11 +447,11 @@
Removes all items from the . This implementation always throws .
- is set to zero, and references to other objects from elements of the collection are also released.
-
+ is set to zero, and references to other objects from elements of the collection are also released.
+
]]>
Always thrown.
@@ -506,13 +506,13 @@
if is found in the ; otherwise, .
- uses , whereas, allows the user to specify the implementation to use for comparing keys.
-
- This method is an O(`n`) operation, where `n` is .
-
+ uses , whereas, allows the user to specify the implementation to use for comparing keys.
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -561,13 +561,13 @@
if the is read-only; otherwise, . In the default implementation of , this property always returns .
-
@@ -620,11 +620,11 @@
if was successfully removed from the ; otherwise, . This method also returns if was not found in the original .
- uses , whereas, allows the user to specify the implementation to use for comparing keys.
-
+ uses , whereas, allows the user to specify the implementation to use for comparing keys.
+
]]>
Always thrown.
@@ -675,29 +675,29 @@
Returns an enumerator that iterates through a collection.
An that can be used to iterate through the collection.
- is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
-
- returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
+ is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding elements or changing the capacity, the enumerator is irrecoverably invalidated and the next call to or throws an .
.NET Core 3.0+ only: The only mutating methods which do not invalidate enumerators are and .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
]]>
@@ -751,15 +751,15 @@
The zero-based index in at which copying begins.
Copies the elements of the to an , starting at a particular index.
- [!NOTE]
-> If the type of the source cannot be cast automatically to the type of the destination `array`, the non-generic implementations of throw , whereas the generic implementations throw .
-
- This method is an O(`n`) operation, where `n` is .
-
+> If the type of the source cannot be cast automatically to the type of the destination `array`, the non-generic implementations of throw , whereas the generic implementations throw .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -767,18 +767,18 @@
is less than zero.
- is multidimensional.
-
- -or-
-
- does not have zero-based indexing.
-
- -or-
-
- The number of elements in the source is greater than the available space from to the end of the destination .
-
- -or-
-
+ is multidimensional.
+
+ -or-
+
+ does not have zero-based indexing.
+
+ -or-
+
+ The number of elements in the source is greater than the available space from to the end of the destination .
+
+ -or-
+
The type of the source cannot be cast automatically to the type of the destination .
@@ -828,17 +828,17 @@
if access to the is synchronized (thread safe); otherwise, . In the default implementation of , this property always returns .
- are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- returns an object, which can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection.
-
- Retrieving the value of this property is an O(1) operation.
-
+ are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ returns an object, which can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection.
+
+ Retrieving the value of this property is an O(1) operation.
+
]]>
@@ -893,42 +893,31 @@
Gets an object that can be used to synchronize access to the .
An object that can be used to synchronize access to the . In the default implementation of , this property always returns the current instance.
- are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- returns an object, which can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
-
-```csharp
-ICollection ic = ...;
-lock (ic.SyncRoot) {
- // Access the collection.
-}
-```
-
-```vb
-Dim ic As ICollection = ...
-SyncLock ic.SyncRoot
- ' Access the collection.
-End SyncLock
-```
-
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Retrieving the value of this property is an O(1) operation.
-
+ are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ returns an object, which can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
+
+```csharp
+ICollection ic = ...;
+lock (ic.SyncRoot) {
+ // Access the collection.
+}
+```
+
+```vb
+Dim ic As ICollection = ...
+SyncLock ic.SyncRoot
+ ' Access the collection.
+End SyncLock
+```
+
+ Retrieving the value of this property is an O(1) operation.
+
]]>
@@ -978,29 +967,29 @@ finally {
Returns an enumerator that iterates through a collection.
An that can be used to iterate through the collection.
- also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
-
- returns the same object until either or is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
-
+ also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ returns the same object until either or is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
+
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding elements or changing the capacity, the enumerator is irrecoverably invalidated and the next call to or throws an .
.NET Core 3.0+ only: The only mutating methods which do not invalidate enumerators are and .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
]]>
diff --git a/xml/System.Collections.Generic/Dictionary`2.xml b/xml/System.Collections.Generic/Dictionary`2.xml
index 925c7881b0f..0fb79acae8d 100644
--- a/xml/System.Collections.Generic/Dictionary`2.xml
+++ b/xml/System.Collections.Generic/Dictionary`2.xml
@@ -2489,7 +2489,7 @@
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
- The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
+ The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection. The following code shows the use of the property.
```csharp
ICollection ic = ...;
@@ -2505,18 +2505,7 @@ SyncLock ic.SyncRoot
End SyncLock
```
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Getting the value of this property is an O(1) operation.
+Getting the value of this property is an O(1) operation.
]]>
diff --git a/xml/System.Collections.Generic/LinkedList`1.xml b/xml/System.Collections.Generic/LinkedList`1.xml
index b0ae3599470..f9673975cdc 100644
--- a/xml/System.Collections.Generic/LinkedList`1.xml
+++ b/xml/System.Collections.Generic/LinkedList`1.xml
@@ -2331,7 +2331,7 @@
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
- returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
+ returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
```csharp
ICollection ic = ...;
@@ -2347,18 +2347,7 @@ SyncLock ic.SyncRoot
End SyncLock
```
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Retrieving the value of this property is an O(1) operation.
+Retrieving the value of this property is an O(1) operation.
]]>
diff --git a/xml/System.Collections.Generic/List`1.xml b/xml/System.Collections.Generic/List`1.xml
index d1070db8376..3f9844a76ff 100644
--- a/xml/System.Collections.Generic/List`1.xml
+++ b/xml/System.Collections.Generic/List`1.xml
@@ -4539,7 +4539,7 @@ Public Function StartsWith(e As Employee) As Boolean
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
- returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
+ returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
```csharp
ICollection ic = ...;
@@ -4556,20 +4556,7 @@ SyncLock ic.SyncRoot
End SyncLock
```
-```cpp
-ICollection^ ic = ...;
-try
-{
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally
-{
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Retrieving the value of this property is an O(1) operation.
+Retrieving the value of this property is an O(1) operation.
]]>
diff --git a/xml/System.Collections.Generic/Queue`1.xml b/xml/System.Collections.Generic/Queue`1.xml
index 884cb1135b3..34d8f3a551f 100644
--- a/xml/System.Collections.Generic/Queue`1.xml
+++ b/xml/System.Collections.Generic/Queue`1.xml
@@ -1252,7 +1252,7 @@
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
- returns an object, which can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
+ returns an object, which can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
```csharp
ICollection ic = ...;
@@ -1268,18 +1268,7 @@ SyncLock ic.SyncRoot
End SyncLock
```
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Retrieving the value of this property is an O(1) operation.
+Retrieving the value of this property is an O(1) operation.
]]>
diff --git a/xml/System.Collections.Generic/SortedDictionary`2+KeyCollection.xml b/xml/System.Collections.Generic/SortedDictionary`2+KeyCollection.xml
index 9142c6a6b60..8dfbf93404a 100644
--- a/xml/System.Collections.Generic/SortedDictionary`2+KeyCollection.xml
+++ b/xml/System.Collections.Generic/SortedDictionary`2+KeyCollection.xml
@@ -98,17 +98,17 @@
Represents the collection of keys in a . This class cannot be inherited.
- property returns an instance of this type, containing all the keys in that . The order of the keys in the is the same as the order of elements in the , the same as the order of the associated values in the returned by the property.
-
- The is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the continue to be reflected in the .
-
+ property returns an instance of this type, containing all the keys in that . The order of the keys in the is the same as the order of elements in the , the same as the order of the associated values in the returned by the property.
+
+ The is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the continue to be reflected in the .
+
]]>
- Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
-
+ Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
+
A can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
@@ -152,13 +152,13 @@
The whose keys are reflected in the new .
Initializes a new instance of the class that reflects the keys in the specified .
- is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the continue to be reflected in the .
-
- This constructor is an O(1) operation.
-
+ is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the continue to be reflected in the .
+
+ This constructor is an O(1) operation.
+
]]>
@@ -244,13 +244,13 @@
The zero-based index in at which copying begins.
Copies the elements to an existing one-dimensional array, starting at the specified array index.
- .
-
- This method is an O(`n`) operation, where `n` is .
-
+ .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -306,11 +306,11 @@
Gets the number of elements contained in the .
The number of elements contained in the .
-
@@ -356,27 +356,27 @@
Returns an enumerator that iterates through the .
A structure for the .
- is undefined. You must call the method to advance the enumerator to the first element of the collection before reading the value of .
-
- The property returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in the namespace are not synchronized.
-
+ is undefined. You must call the method to advance the enumerator to the first element of the collection before reading the value of .
+
+ The property returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in the namespace are not synchronized.
+
This method is an O(log n) operation where n is a number of elements in a collection.
-
+
]]>
@@ -476,11 +476,11 @@
Removes all items from the . This implementation always throws a .
- property is set to 0, and references to other objects from elements of the collection are also released.
-
+ property is set to 0, and references to other objects from elements of the collection are also released.
+
]]>
Always thrown; the collection is read-only.
@@ -532,13 +532,13 @@
if item is found in the ; otherwise, .
- uses , whereas allows the user to specify the implementation to use for comparing keys.
-
- This method is an O(1) operation.
-
+ uses , whereas allows the user to specify the implementation to use for comparing keys.
+
+ This method is an O(1) operation.
+
]]>
@@ -587,13 +587,13 @@
if the is read-only; otherwise, . In the default implementation of , this property always returns .
-
@@ -646,11 +646,11 @@
if item is successfully removed from the ; otherwise, . This method also returns if item is not found in the .
- uses , whereas allows the user to specify the implementation to use for comparing keys.
-
+ uses , whereas allows the user to specify the implementation to use for comparing keys.
+
]]>
Always thrown; the collection is read-only.
@@ -701,27 +701,27 @@
Returns an enumerator that iterates through the collection.
An that can be used to iterate through the collection.
- property is undefined. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of .
-
- The property returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns false. When the enumerator is at this position, subsequent calls to also return false. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in the namespace are not synchronized.
-
+ property is undefined. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of .
+
+ The property returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns false. When the enumerator is at this position, subsequent calls to also return false. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in the namespace are not synchronized.
+
This method is an O(log n) operation where n is a number of elements in a collection.
-
+
]]>
@@ -775,15 +775,15 @@
The zero-based index in at which copying begins.
Copies the elements of the to an array, starting at a particular array index.
- [!NOTE]
-> If the type of the source cannot be cast automatically to the type of the destination `array`, the nongeneric implementations of throw an , whereas the generic implementations throw an .
-
- This method is an O(`n`) operation, where `n` is .
-
+> If the type of the source cannot be cast automatically to the type of the destination `array`, the nongeneric implementations of throw an , whereas the generic implementations throw an .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -791,18 +791,18 @@
is less than 0.
- is multidimensional.
-
- -or-
-
- does not have zero-based indexing.
-
- -or-
-
- The number of elements in the source is greater than the available space from to the end of the destination .
-
- -or-
-
+ is multidimensional.
+
+ -or-
+
+ does not have zero-based indexing.
+
+ -or-
+
+ The number of elements in the source is greater than the available space from to the end of the destination .
+
+ -or-
+
The type of the source cannot be cast automatically to the type of the destination .
@@ -852,17 +852,17 @@
if access to the is synchronized (thread safe); otherwise, . In the default implementation of , this property always returns .
- namespace are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection.
-
- Getting the value of this property is an O(1) operation.
-
+ namespace are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection.
+
+ Getting the value of this property is an O(1) operation.
+
]]>
@@ -917,45 +917,32 @@
Gets an object that can be used to synchronize access to the .
An object that can be used to synchronize access to the . In the default implementation of , this property always returns the current instance.
- namespace are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
-
-```csharp
-ICollection ic = ...;
-lock (ic.SyncRoot)
-{
- // Access the collection.
-}
-```
-
-```vb
-Dim ic As ICollection = ...
-SyncLock ic.SyncRoot
- ' Access the collection.
-End SyncLock
-```
-
-```cpp
-ICollection^ ic = ...;
-try
-{
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally
-{
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Getting the value of this property is an O(1) operation.
-
+ namespace are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection. The following code shows the use of the property.
+
+```csharp
+ICollection ic = ...;
+lock (ic.SyncRoot)
+{
+ // Access the collection.
+}
+```
+
+```vb
+Dim ic As ICollection = ...
+SyncLock ic.SyncRoot
+ ' Access the collection.
+End SyncLock
+```
+
+Getting the value of this property is an O(1) operation.
+
]]>
@@ -1005,27 +992,27 @@ finally
Returns an enumerator that iterates through the collection.
An that can be used to iterate through the collection.
- also brings the enumerator back to this position. At this position, the property is undefined. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of .
-
- The property returns the same object until either or is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in the namespace are not synchronized.
-
+ also brings the enumerator back to this position. At this position, the property is undefined. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of .
+
+ The property returns the same object until either or is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in the namespace are not synchronized.
+
This method is an O(log n) operation where n is a number of elements in a collection.
-
+
]]>
diff --git a/xml/System.Collections.Generic/SortedDictionary`2+ValueCollection.xml b/xml/System.Collections.Generic/SortedDictionary`2+ValueCollection.xml
index ede6ba3aeb2..6340ca930bf 100644
--- a/xml/System.Collections.Generic/SortedDictionary`2+ValueCollection.xml
+++ b/xml/System.Collections.Generic/SortedDictionary`2+ValueCollection.xml
@@ -98,17 +98,17 @@
Represents the collection of values in a . This class cannot be inherited.
- property returns an instance of this type, containing all the values in that . The order of the values in the is the same as the order of the elements in the , and the same as the order of the associated keys in the returned by the property.
-
- The is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the continue to be reflected in the .
-
+ property returns an instance of this type, containing all the values in that . The order of the values in the is the same as the order of the elements in the , and the same as the order of the associated keys in the returned by the property.
+
+ The is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the continue to be reflected in the .
+
]]>
- Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
-
+ Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
+
A can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
@@ -152,13 +152,13 @@
The whose values are reflected in the new .
Initializes a new instance of the class that reflects the values in the specified .
- is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the continue to be reflected in the .
-
- This constructor is an O(1) operation.
-
+ is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the continue to be reflected in the .
+
+ This constructor is an O(1) operation.
+
]]>
@@ -213,13 +213,13 @@
The zero-based index in at which copying begins.
Copies the elements to an existing one-dimensional array, starting at the specified array index.
- .
-
- This method is an O(`n`) operation, where `n` is .
-
+ .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -275,11 +275,11 @@
Gets the number of elements contained in the .
The number of elements contained in the .
-
@@ -325,27 +325,27 @@
Returns an enumerator that iterates through the .
A structure for the .
- is undefined. You must call the method to advance the enumerator to the first element of the collection before reading the value of .
-
- The property returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in the namespace are not synchronized.
-
+ is undefined. You must call the method to advance the enumerator to the first element of the collection before reading the value of .
+
+ The property returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in the namespace are not synchronized.
+
This method is an O(log n) operation where n is a number of elements in a collection.
-
+
]]>
@@ -445,11 +445,11 @@
Removes all items from the . This implementation always throws a .
- property is set to 0, and references to other objects from elements of the collection are also released.
-
+ property is set to 0, and references to other objects from elements of the collection are also released.
+
]]>
Always thrown; the collection is read-only.
@@ -504,13 +504,13 @@
if is found in the ; otherwise, .
- uses , whereas allows the user to specify the implementation to use for comparing keys.
-
- This method is an O(`n`) operation, where `n` is .
-
+ uses , whereas allows the user to specify the implementation to use for comparing keys.
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -559,13 +559,13 @@
if the is read-only; otherwise, . In the default implementation of , this property always returns .
-
@@ -618,11 +618,11 @@
if is successfully removed from the ; otherwise, . This method also returns if is not found in the .
- uses , whereas allows the user to specify the implementation to use for comparing keys.
-
+ uses , whereas allows the user to specify the implementation to use for comparing keys.
+
]]>
Always thrown; the collection is read-only.
@@ -673,27 +673,27 @@
Returns an enumerator that iterates through the collection.
An that can be used to iterate through the collection.
- property is undefined. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of .
-
- The property returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in the namespace are not synchronized.
-
+ property is undefined. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of .
+
+ The property returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in the namespace are not synchronized.
+
This method is an O(log n) operation where n is a number of elements in a collection.
-
+
]]>
@@ -747,15 +747,15 @@
The zero-based index in at which copying begins.
Copies the elements of the to an array, starting at a particular array index.
- [!NOTE]
-> If the type of the source cannot be cast automatically to the type of the destination `array`, the nongeneric implementations of throw an , whereas the generic implementations throw an .
-
- This method is an O(`n`) operation, where `n` is .
-
+> If the type of the source cannot be cast automatically to the type of the destination `array`, the nongeneric implementations of throw an , whereas the generic implementations throw an .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -763,18 +763,18 @@
is less than 0.
- is multidimensional.
-
- -or-
-
- does not have zero-based indexing.
-
- -or-
-
- The number of elements in the source is greater than the available space from to the end of the destination .
-
- -or-
-
+ is multidimensional.
+
+ -or-
+
+ does not have zero-based indexing.
+
+ -or-
+
+ The number of elements in the source is greater than the available space from to the end of the destination .
+
+ -or-
+
The type of the source cannot be cast automatically to the type of the destination .
@@ -824,17 +824,17 @@
if access to the is synchronized (thread safe); otherwise, . In the default implementation of , this property always returns .
- namespace are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection.
-
- Getting the value of this property is an O(1) operation.
-
+ namespace are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection.
+
+ Getting the value of this property is an O(1) operation.
+
]]>
@@ -889,45 +889,32 @@
Gets an object that can be used to synchronize access to the .
An object that can be used to synchronize access to the . In the default implementation of , this property always returns the current instance.
- namespace are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
-
-```csharp
-ICollection ic = ...;
-lock (ic.SyncRoot)
-{
- // Access the collection.
-}
-```
-
-```vb
-Dim ic As ICollection = ...
-SyncLock ic.SyncRoot
- ' Access the collection.
-End SyncLock
-```
-
-```cpp
-ICollection^ ic = ...;
-try
-{
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally
-{
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Getting the value of this property is an O(1) operation.
-
+ namespace are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection. The following code shows the use of the property.
+
+```csharp
+ICollection ic = ...;
+lock (ic.SyncRoot)
+{
+ // Access the collection.
+}
+```
+
+```vb
+Dim ic As ICollection = ...
+SyncLock ic.SyncRoot
+ ' Access the collection.
+End SyncLock
+```
+
+Getting the value of this property is an O(1) operation.
+
]]>
@@ -977,27 +964,27 @@ finally
Returns an enumerator that iterates through the collection.
An that can be used to iterate through the collection.
- also brings the enumerator back to this position. At this position, the property is undefined. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of .
-
- The property returns the same object until either or is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in the namespace are not synchronized.
-
+ also brings the enumerator back to this position. At this position, the property is undefined. Therefore, you must call the method to advance the enumerator to the first element of the collection before reading the value of .
+
+ The property returns the same object until either or is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in the namespace are not synchronized.
+
This method is an O(log n) operation where n is a number of elements in a collection.
-
+
]]>
diff --git a/xml/System.Collections.Generic/SortedDictionary`2.xml b/xml/System.Collections.Generic/SortedDictionary`2.xml
index 3ad66dc53dd..e1748768356 100644
--- a/xml/System.Collections.Generic/SortedDictionary`2.xml
+++ b/xml/System.Collections.Generic/SortedDictionary`2.xml
@@ -1831,7 +1831,7 @@
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
- The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
+ The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock the object before accessing the collection. The following code shows the use of the property.
```csharp
ICollection ic = ...;
@@ -1848,20 +1848,7 @@ SyncLock ic.SyncRoot
End SyncLock
```
-```cpp
-ICollection^ ic = ...;
-try
-{
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally
-{
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Getting the value of this property is an O(1) operation.
+Getting the value of this property is an O(1) operation.
]]>
diff --git a/xml/System.Collections.Generic/SortedList`2.xml b/xml/System.Collections.Generic/SortedList`2.xml
index 13a8c58b3fc..dd3062b9228 100644
--- a/xml/System.Collections.Generic/SortedList`2.xml
+++ b/xml/System.Collections.Generic/SortedList`2.xml
@@ -2360,7 +2360,7 @@
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
- The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
+ The property returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
```csharp
ICollection ic = ...;
@@ -2376,18 +2376,7 @@ SyncLock ic.SyncRoot
End SyncLock
```
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Retrieving the value of this property is an O(1) operation.
+Retrieving the value of this property is an O(1) operation.
]]>
diff --git a/xml/System.Collections.Generic/Stack`1.xml b/xml/System.Collections.Generic/Stack`1.xml
index d72ebb016fe..0f541852568 100644
--- a/xml/System.Collections.Generic/Stack`1.xml
+++ b/xml/System.Collections.Generic/Stack`1.xml
@@ -100,50 +100,50 @@
Specifies the type of elements in the stack.
Represents a variable size last-in-first-out (LIFO) collection of instances of the same specified type.
- is implemented as an array.
-
- Stacks and queues are useful when you need temporary storage for information; that is, when you might want to discard an element after retrieving its value. Use if you need to access the information in the same order that it is stored in the collection. Use if you need to access the information in reverse order.
-
- Use the and types when you need to access the collection from multiple threads concurrently.
-
- A common use for is to preserve variable states during calls to other procedures.
-
- Three main operations can be performed on a and its elements:
-
-- inserts an element at the top of the .
-
-- removes an element from the top of the .
-
-- returns an element that is at the top of the but does not remove it from the .
-
- The capacity of a is the number of elements the can hold. As elements are added to a , the capacity is automatically increased as required by reallocating the internal array. The capacity can be decreased by calling .
-
- If is less than the capacity of the stack, is an O(1) operation. If the capacity needs to be increased to accommodate the new element, becomes an O(`n`) operation, where `n` is . is an O(1) operation.
-
- accepts `null` as a valid value for reference types and allows duplicate elements.
-
-
-
-## Examples
- The following code example demonstrates several methods of the generic class. The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ is implemented as an array.
+
+ Stacks and queues are useful when you need temporary storage for information; that is, when you might want to discard an element after retrieving its value. Use if you need to access the information in the same order that it is stored in the collection. Use if you need to access the information in reverse order.
+
+ Use the and types when you need to access the collection from multiple threads concurrently.
+
+ A common use for is to preserve variable states during calls to other procedures.
+
+ Three main operations can be performed on a and its elements:
+
+- inserts an element at the top of the .
+
+- removes an element from the top of the .
+
+- returns an element that is at the top of the but does not remove it from the .
+
+ The capacity of a is the number of elements the can hold. As elements are added to a , the capacity is automatically increased as required by reallocating the internal array. The capacity can be decreased by calling .
+
+ If is less than the capacity of the stack, is an O(1) operation. If the capacity needs to be increased to accommodate the new element, becomes an O(`n`) operation, where `n` is . is an O(1) operation.
+
+ accepts `null` as a valid value for reference types and allows duplicate elements.
+
+
+
+## Examples
+ The following code example demonstrates several methods of the generic class. The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+
]]>
- Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
-
+ Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
+
A can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
Iterators (C#)
Iterators (Visual Basic)
@@ -196,30 +196,30 @@
Initializes a new instance of the class that is empty and has the default initial capacity.
- is the number of elements that the can hold. As elements are added to a , the capacity is automatically increased as required by reallocating the internal array.
-
- If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .
-
- The capacity can be decreased by calling .
-
- This constructor is an O(1) operation.
-
-
-
-## Examples
- The following code example demonstrates this constructor and several methods of the generic class.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ is the number of elements that the can hold. As elements are added to a , the capacity is automatically increased as required by reallocating the internal array.
+
+ If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .
+
+ The capacity can be decreased by calling .
+
+ This constructor is an O(1) operation.
+
+
+
+## Examples
+ The following code example demonstrates this constructor and several methods of the generic class.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
@@ -268,32 +268,32 @@
The collection to copy elements from.
Initializes a new instance of the class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.
- is the number of elements that the can hold. As elements are added to a , the capacity is automatically increased as required by reallocating the internal array.
-
- If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .
-
- The capacity can be decreased by calling .
-
- The elements are copied onto the in the same order they are read by the of the collection.
-
- This constructor is an O(`n`) operation, where `n` is the number of elements in `collection`.
-
-
-
-## Examples
- The following code example demonstrates this constructor and several methods of the generic class.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ is the number of elements that the can hold. As elements are added to a , the capacity is automatically increased as required by reallocating the internal array.
+
+ If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .
+
+ The capacity can be decreased by calling .
+
+ The elements are copied onto the in the same order they are read by the of the collection.
+
+ This constructor is an O(`n`) operation, where `n` is the number of elements in `collection`.
+
+
+
+## Examples
+ The following code example demonstrates this constructor and several methods of the generic class.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
@@ -346,17 +346,17 @@
The initial number of elements that the can contain.
Initializes a new instance of the class that is empty and has the specified initial capacity or the default initial capacity, whichever is greater.
- is the number of elements that the can hold. As elements are added to a , the capacity is automatically increased as required by reallocating the internal array.
-
- If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .
-
- The capacity can be decreased by calling .
-
- This constructor is an O(`n`) operation, where `n` is `capacity`.
-
+ is the number of elements that the can hold. As elements are added to a , the capacity is automatically increased as required by reallocating the internal array.
+
+ If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .
+
+ The capacity can be decreased by calling .
+
+ This constructor is an O(`n`) operation, where `n` is `capacity`.
+
]]>
@@ -431,32 +431,32 @@
Removes all objects from the .
- is set to zero, and references to other objects from elements of the collection are also released.
-
- The capacity remains unchanged. To reset the capacity of the , call . Trimming an empty sets the capacity of the to the default capacity.
-
- This method is an O(`n`) operation, where `n` is .
-
-
-
-## Examples
- The following code example demonstrates several methods of the generic class, including the method.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ is set to zero, and references to other objects from elements of the collection are also released.
+
+ The capacity remains unchanged. To reset the capacity of the , call . Trimming an empty sets the capacity of the to the default capacity.
+
+ This method is an O(`n`) operation, where `n` is .
+
+
+
+## Examples
+ The following code example demonstrates several methods of the generic class, including the method.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
+
]]>
@@ -506,30 +506,30 @@
if is found in the ; otherwise, .
- for `T`, the type of values in the list.
-
- This method performs a linear search; therefore, this method is an O(`n`) operation, where `n` is .
-
-
-
-## Examples
- The following code example demonstrates several methods of the generic class, including the method.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ for `T`, the type of values in the list.
+
+ This method performs a linear search; therefore, this method is an O(`n`) operation, where `n` is .
+
+
+
+## Examples
+ The following code example demonstrates several methods of the generic class, including the method.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
+
]]>
Performing Culture-Insensitive String Operations in Collections
@@ -580,30 +580,30 @@
The zero-based index in at which copying begins.
Copies the to an existing one-dimensional , starting at the specified array index.
- .
-
- This method is an O(`n`) operation, where `n` is .
-
-
-
-## Examples
- The following code example demonstrates several methods of the generic class, including the method.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ .
+
+ This method is an O(`n`) operation, where `n` is .
+
+
+
+## Examples
+ The following code example demonstrates several methods of the generic class, including the method.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
+
]]>
@@ -664,32 +664,32 @@
Gets the number of elements contained in the .
The number of elements contained in the .
- is the number of elements that the can store. is the number of elements that are actually in the .
-
- The capacity is always greater than or equal to . If exceeds the capacity while adding elements, the capacity is increased by automatically reallocating the internal array before copying the old elements and adding the new elements.
-
- Retrieving the value of this property is an O(1) operation.
-
-
-
-## Examples
- The following code example demonstrates several properties and methods of the generic class, including the property.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ is the number of elements that the can store. is the number of elements that are actually in the .
+
+ The capacity is always greater than or equal to . If exceeds the capacity while adding elements, the capacity is increased by automatically reallocating the internal array before copying the old elements and adding the new elements.
+
+ Retrieving the value of this property is an O(1) operation.
+
+
+
+## Examples
+ The following code example demonstrates several properties and methods of the generic class, including the property.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
+
]]>
@@ -770,44 +770,44 @@
Returns an enumerator for the .
An for the .
- is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
-
- returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
-
-
-## Examples
- The following code example demonstrates that the generic class is enumerable. The `foreach` statement (`For Each` in Visual Basic, `for each` in C++) is used to enumerate the stack.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
+
+
+## Examples
+ The following code example demonstrates that the generic class is enumerable. The `foreach` statement (`For Each` in Visual Basic, `for each` in C++) is used to enumerate the stack.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
+
]]>
@@ -855,32 +855,32 @@
Returns the object at the top of the without removing it.
The object at the top of the .
- method, but does not modify the .
-
- If type `T` is a reference type, `null` can be pushed onto the as a placeholder, if needed.
-
- This method is an O(1) operation.
-
-
-
-## Examples
- The following code example demonstrates several methods of the generic class, including the method.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ method, but does not modify the .
+
+ If type `T` is a reference type, `null` can be pushed onto the as a placeholder, if needed.
+
+ This method is an O(1) operation.
+
+
+
+## Examples
+ The following code example demonstrates several methods of the generic class, including the method.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+
]]>
The is empty.
@@ -929,28 +929,28 @@
Removes and returns the object at the top of the .
The object removed from the top of the .
- method, but does not modify the .
-
- If type `T` is a reference type, `null` can be pushed onto the as a placeholder, if needed.
-
- is implemented as an array. This method is an O(1) operation.
-
-
-
-## Examples
- The following code example demonstrates several methods of the generic class, including the method.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ method, but does not modify the .
+
+ If type `T` is a reference type, `null` can be pushed onto the as a placeholder, if needed.
+
+ is implemented as an array. This method is an O(1) operation.
+
+
+
+## Examples
+ The following code example demonstrates several methods of the generic class, including the method.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
@@ -1005,34 +1005,34 @@
The object to push onto the . The value can be for reference types.
Inserts an object at the top of the .
- is implemented as an array.
-
- If already equals the capacity, the capacity of the is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.
-
- If type `T` is a reference type, `null` can be pushed onto the as a placeholder, if needed. It occupies a slot in the stack and is treated like any object.
-
- If is less than the capacity of the stack, is an O(1) operation. If the capacity needs to be increased to accommodate the new element, becomes an O(`n`) operation, where `n` is .
-
-
-
-## Examples
- The following code example demonstrates several methods of the generic class, including the method.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ is implemented as an array.
+
+ If already equals the capacity, the capacity of the is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.
+
+ If type `T` is a reference type, `null` can be pushed onto the as a placeholder, if needed. It occupies a slot in the stack and is treated like any object.
+
+ If is less than the capacity of the stack, is an O(1) operation. If the capacity needs to be increased to accommodate the new element, becomes an O(`n`) operation, where `n` is .
+
+
+
+## Examples
+ The following code example demonstrates several methods of the generic class, including the method.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+
]]>
@@ -1083,27 +1083,27 @@
Returns an enumerator that iterates through the collection.
An that can be used to iterate through the collection.
- is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
-
- returns the same object until is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
+ is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ returns the same object until is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. You cannot set to the first element of the collection again; you must create a new enumerator instance instead.
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
]]>
@@ -1157,15 +1157,15 @@
The zero-based index in at which copying begins.
Copies the elements of the to an , starting at a particular index.
- [!NOTE]
-> If the type of the source cannot be cast automatically to the type of the destination `array`, the non-generic implementations of throw , whereas the generic implementations throw .
-
- This method is an O(`n`) operation, where `n` is .
-
+> If the type of the source cannot be cast automatically to the type of the destination `array`, the non-generic implementations of throw , whereas the generic implementations throw .
+
+ This method is an O(`n`) operation, where `n` is .
+
]]>
@@ -1173,18 +1173,18 @@
is less than zero.
- is multidimensional.
-
- -or-
-
- does not have zero-based indexing.
-
- -or-
-
- The number of elements in the source is greater than the available space from to the end of the destination .
-
- -or-
-
+ is multidimensional.
+
+ -or-
+
+ does not have zero-based indexing.
+
+ -or-
+
+ The number of elements in the source is greater than the available space from to the end of the destination .
+
+ -or-
+
The type of the source cannot be cast automatically to the type of the destination .
@@ -1232,17 +1232,17 @@
if access to the is synchronized (thread safe); otherwise, . In the default implementation of , this property always returns .
- are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. In the rare case where enumerations contend with write accesses, you must lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection.
-
- Retrieving the value of this property is an O(1) operation.
-
+ are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. In the rare case where enumerations contend with write accesses, you must lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection.
+
+ Retrieving the value of this property is an O(1) operation.
+
]]>
@@ -1292,42 +1292,31 @@
Gets an object that can be used to synchronize access to the .
An object that can be used to synchronize access to the . In the default implementation of , this property always returns the current instance.
- are not synchronized.
-
- Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
-
-```csharp
-ICollection ic = ...;
-lock (ic.SyncRoot) {
- // Access the collection.
-}
-```
-
-```vb
-Dim ic As ICollection = ...
-SyncLock ic.SyncRoot
- ' Access the collection.
-End SyncLock
-```
-
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Retrieving the value of this property is an O(1) operation.
-
+ are not synchronized.
+
+ Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
+
+```csharp
+ICollection ic = ...;
+lock (ic.SyncRoot) {
+ // Access the collection.
+}
+```
+
+```vb
+Dim ic As ICollection = ...
+SyncLock ic.SyncRoot
+ ' Access the collection.
+End SyncLock
+```
+
+Retrieving the value of this property is an O(1) operation.
+
]]>
@@ -1377,27 +1366,27 @@ finally {
Returns an enumerator that iterates through a collection.
An that can be used to iterate through the collection.
- also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
-
- returns the same object until either or is called. sets to the next element.
-
- If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
-
- An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
-
- The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
-
- Default implementations of collections in are not synchronized.
-
- This method is an O(1) operation.
-
+ also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .
+
+ returns the same object until either or is called. sets to the next element.
+
+ If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns `false`. When the enumerator is at this position, subsequent calls to also return `false`. If the last call to returned `false`, is undefined. To set to the first element of the collection again, you can call followed by .
+
+ An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to or throws an .
+
+ The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
+
+ Default implementations of collections in are not synchronized.
+
+ This method is an O(1) operation.
+
]]>
@@ -1446,30 +1435,30 @@ finally {
Copies the to a new array.
A new array containing copies of the elements of the .
- .
-
- This method is an O(`n`) operation, where `n` is .
-
-
-
-## Examples
- The following code example demonstrates several methods of the generic class, including the method.
-
- The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
-
- The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
-
- An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
-
- The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
-
+ .
+
+ This method is an O(`n`) operation, where `n` is .
+
+
+
+## Examples
+ The following code example demonstrates several methods of the generic class, including the method.
+
+ The code example creates a stack of strings with default capacity and uses the method to push five strings onto the stack. The elements of the stack are enumerated, which does not change the state of the stack. The method is used to pop the first string off the stack. The method is used to look at the next item on the stack, and then the method is used to pop it off.
+
+ The method is used to create an array and copy the stack elements to it, then the array is passed to the constructor that takes , creating a copy of the stack with the order of the elements reversed. The elements of the copy are displayed.
+
+ An array twice the size of the stack is created, and the method is used to copy the array elements beginning at the middle of the array. The constructor is used again to create a copy of the stack with the order of elements reversed; thus, the three null elements are at the end.
+
+ The method is used to show that the string "four" is in the first copy of the stack, after which the method clears the copy and the property shows that the stack is empty.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/StackT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Collections.Generic/StackT/Overview/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Generic.Stack/vb/source.vb" id="Snippet1":::
+
]]>
@@ -1516,15 +1505,15 @@ finally {
Sets the capacity to the actual number of elements in the , if that number is less than 90 percent of current capacity.
- can be considerable, however, so the method does nothing if the list is at more than 90 percent of capacity. This avoids incurring a large reallocation cost for a relatively small gain.
-
- This method is an O(`n`) operation, where `n` is .
-
- To reset a to its initial state, call the method before calling method. Trimming an empty sets the capacity of the to the default capacity.
-
+ can be considerable, however, so the method does nothing if the list is at more than 90 percent of capacity. This avoids incurring a large reallocation cost for a relatively small gain.
+
+ This method is an O(`n`) operation, where `n` is .
+
+ To reset a to its initial state, call the method before calling method. Trimming an empty sets the capacity of the to the default capacity.
+
]]>
diff --git a/xml/System.Collections.ObjectModel/Collection`1.xml b/xml/System.Collections.ObjectModel/Collection`1.xml
index 7a1cae9bffb..cd958f30b64 100644
--- a/xml/System.Collections.ObjectModel/Collection`1.xml
+++ b/xml/System.Collections.ObjectModel/Collection`1.xml
@@ -1755,7 +1755,7 @@
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
- returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, C++, and Visual Basic.
+ returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
```csharp
ICollection ic = ...;
@@ -1771,18 +1771,7 @@ SyncLock ic.SyncRoot
End SyncLock
```
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
-
- Retrieving the value of this property is an O(1) operation.
+Retrieving the value of this property is an O(1) operation.
]]>
diff --git a/xml/System.Collections.ObjectModel/ReadOnlyCollection`1.xml b/xml/System.Collections.ObjectModel/ReadOnlyCollection`1.xml
index 3078df9fcb6..3bde909b91d 100644
--- a/xml/System.Collections.ObjectModel/ReadOnlyCollection`1.xml
+++ b/xml/System.Collections.ObjectModel/ReadOnlyCollection`1.xml
@@ -1405,7 +1405,7 @@
Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.
- returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property for C#, Visual C++, and Visual Basic.
+ returns an object that can be used to synchronize access to the . Synchronization is effective only if all threads lock this object before accessing the collection. The following code shows the use of the property.
```csharp
ICollection ic = ...;
@@ -1421,20 +1421,9 @@ SyncLock ic.SyncRoot
End SyncLock
```
-```cpp
-ICollection^ ic = ...;
-try {
- Monitor::Enter(ic->SyncRoot);
- // Access the collection.
-}
-finally {
- Monitor::Exit(ic->SyncRoot);
-}
-```
+Retrieving the value of this property is an O(1) operation.
- Retrieving the value of this property is an O(1) operation.
-
- This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
+This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
]]>
diff --git a/xml/System.DirectoryServices/DirectoryEntries.xml b/xml/System.DirectoryServices/DirectoryEntries.xml
index ecbefbe569f..a45cade6686 100644
--- a/xml/System.DirectoryServices/DirectoryEntries.xml
+++ b/xml/System.DirectoryServices/DirectoryEntries.xml
@@ -65,62 +65,41 @@
Creates a new entry in the container.
A object that represents the new entry.
- method on the new entry to make the creation permanent. When you call this method, you can then set mandatory property values on the new entry. The providers each have different requirements for properties that need to be set before a call to the method is made. If those requirements are not met, the provider might throw an exception. Check with your provider to determine which properties must be set before committing changes.
-
-
-
-## Examples
- The following Visual Basic .NET example creates a new object with a specified path, then creates a new entry in the container and saves it.
-
-```vb
-Dim strPath As String = "IIS://localhost/W3SVC/1/Root"
-' Create a new 'DirectoryEntry' object with the given path.
-Dim myDE As New DirectoryEntry(strPath)
-Dim myEntries As DirectoryEntries = myDE.Children
-' Create a new entry 'Sample' in the container.
-Dim myDirectoryEntry As DirectoryEntry = myEntries.Add("CN=Sample", myDE.SchemaClassName)
-' Save changes of entry in the 'Active Directory Domain Services'.
-myDirectoryEntry.CommitChanges()
-Console.WriteLine(myDirectoryEntry.Name + " entry is created in container.")
-```
-
- The following C# example creates a new object with a specified path, then creates a new entry in the container and saves it.
-
-```csharp
-String strPath = "IIS://localhost/W3SVC/1/Root";
-
-// Create a new 'DirectoryEntry' object with the given path.
-DirectoryEntry myDE = new DirectoryEntry(strPath);
-DirectoryEntries myEntries = myDE.Children;
-
-// Create a new entry 'Sample' in the container.
-DirectoryEntry myDirectoryEntry =
- myEntries.Add("CN=Sample", myDE.SchemaClassName);
-// Save changes of entry in the 'Active Directory Domain Services'.
-myDirectoryEntry.CommitChanges();
-Console.WriteLine (myDirectoryEntry.Name + " entry is created in container.");
-```
-
- The following C++ example creates a new object with a specified path, then creates a new entry in the container and saves it.
-
-```cpp
-String* strPath = S"IIS://localhost/W3SVC/1/Root";
-
-// Create a new 'DirectoryEntry' object with the given path.
-DirectoryEntry* myDE = new DirectoryEntry(strPath);
-DirectoryEntries* myEntries = myDE->Children;
-
-// Create a new entry 'Sample' in the container.
-DirectoryEntry* myDirectoryEntry = myEntries->Add(S"CN=Sample", myDE->SchemaClassName);
-// Save changes of entry in the 'Active Directory Domain Services'.
-myDirectoryEntry->CommitChanges();
-Console::WriteLine("{0} entry is created in container.", myDirectoryEntry->Name);
-
-```
-
+ method on the new entry to make the creation permanent. When you call this method, you can then set mandatory property values on the new entry. The providers each have different requirements for properties that need to be set before a call to the method is made. If those requirements are not met, the provider might throw an exception. Check with your provider to determine which properties must be set before committing changes.
+
+## Examples
+ The following example creates a new object with a specified path, then creates a new entry in the container and saves it.
+
+```vb
+Dim strPath As String = "IIS://localhost/W3SVC/1/Root"
+' Create a new 'DirectoryEntry' object with the given path.
+Dim myDE As New DirectoryEntry(strPath)
+Dim myEntries As DirectoryEntries = myDE.Children
+' Create a new entry 'Sample' in the container.
+Dim myDirectoryEntry As DirectoryEntry = myEntries.Add("CN=Sample", myDE.SchemaClassName)
+' Save changes of entry in the 'Active Directory Domain Services'.
+myDirectoryEntry.CommitChanges()
+Console.WriteLine(myDirectoryEntry.Name + " entry is created in container.")
+```
+
+```csharp
+String strPath = "IIS://localhost/W3SVC/1/Root";
+
+// Create a new 'DirectoryEntry' object with the given path.
+DirectoryEntry myDE = new DirectoryEntry(strPath);
+DirectoryEntries myEntries = myDE.Children;
+
+// Create a new entry 'Sample' in the container.
+DirectoryEntry myDirectoryEntry =
+ myEntries.Add("CN=Sample", myDE.SchemaClassName);
+// Save changes of entry in the 'Active Directory Domain Services'.
+myDirectoryEntry.CommitChanges();
+Console.WriteLine (myDirectoryEntry.Name + " entry is created in container.");
+```
+
]]>
An error occurred during the call to the underlying interface.
@@ -163,16 +142,16 @@ Console::WriteLine("{0} entry is created in container.", myDirectoryEntry->Name)
Returns the member of this collection with the specified name.
A that represents the child object that was found.
- [!NOTE]
-> The Internet Information Services (IIS) provider does not support this method. Use the overloaded method and specify an empty string ("") for the `schemaClassName` parameter.
->
-> If no matching result is found, a with error code 0x2030 is thrown.
-
+> The Internet Information Services (IIS) provider does not support this method. Use the overloaded method and specify an empty string ("") for the `schemaClassName` parameter.
+>
+> If no matching result is found, a with error code 0x2030 is thrown.
+
]]>
The Active Directory Domain Services object is not a container.
@@ -217,117 +196,78 @@ Console::WriteLine("{0} entry is created in container.", myDirectoryEntry->Name)
Returns the member of this collection with the specified name and of the specified type.
A object that represents the child object that was found.
- with error code 0x2030 is thrown.
-
-
-
-## Examples
- The following Visual Basic .NET example creates a new object with the specified path, then creates a new entry in the container and saves it. It attempts to retrieve the newly created entry.
-
-```vb
-Try
- Dim myEntry1 As DirectoryEntry
- Dim myEntry2 As DirectoryEntry
- Dim strPath As String = "LDAP://DC=fabrikam,DC=com"
-
- ' Create a 'DirectoryEntry' object with the given path.
- Dim myDE As New DirectoryEntry(strPath)
- Dim myEntries As DirectoryEntries = myDE.Children
-
- ' Create a new entry in the container.
- myEntry1 = myEntries.Add("CN=Sample Entry", myDE.SchemaClassName)
- ' Save changes in the 'Active Directory Domain Services' store.
- myEntry1.CommitChanges()
-
- ' Find a child in the 'DirectoryEntries' collection which has the
- ' specified name and type.
- myEntry2 = myEntries.Find("CN=Sample Entry", myDE.SchemaClassName)
- Console.WriteLine(myEntry2.Name + " is found in container.")
-
- Catch e As Exception
- Console.WriteLine("The following exception was raised : {0}", e.Message.ToString())
- End Try
-```
-
- The following C# example shows how to create a new object with the specified path, then creates a new entry in the container and saves it. It attempts to retrieve the newly- created entry.
-
-```csharp
-using System;
-using System.DirectoryServices;
-
-class MyClass1
-{
- static void Main()
- {
- try
- {
- DirectoryEntry myEntry1;
- DirectoryEntry myEntry2;
- String strPath = "LDAP://DC=fabrikam,DC=com";
-
- // Create a 'DirectoryEntry' object with the given path.
- DirectoryEntry myDE = new DirectoryEntry(strPath);
- DirectoryEntries myEntries = myDE.Children;
-
- // Create a new entry in the container.
- myEntry1 = myEntries.Add("CN=Sample Entry",myDE.SchemaClassName);
- // Save changes in the 'Active Directory Domain Services' store.
- myEntry1.CommitChanges();
-
- // Find a child in the 'DirectoryEntries' collection which has the
- // specified name and type.
- myEntry2 = myEntries.Find("CN=Sample Entry",myDE.SchemaClassName);
- Console.WriteLine (myEntry2.Name + " is found in container.");
-
- }
- catch(Exception e)
- {
- Console.WriteLine("The following exception was raised : {0}",e.Message);
- }
- }
-}
-
-```
-
- The following C++ example creates a new object with the specified path, then creates a new entry in the container and saves it. It attempts to retrieve the new entry.
-
-```cpp
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::DirectoryServices;
-
-int main() {
- try {
- DirectoryEntry* myEntry1;
- DirectoryEntry* myEntry2;
- String* strPath = S"LDAP://DC=fabrikam,DC=com";
-
- // Create a 'DirectoryEntry' object with the given path.
- DirectoryEntry* myDE = new DirectoryEntry(strPath);
- DirectoryEntries* myEntries = myDE->Children;
-
- // Create a new entry in the container.
- myEntry1 = myEntries->Add(S"CN=Sample Entry", myDE->SchemaClassName);
- // Save changes in the 'Active Directory Domain Services' store.
- myEntry1->CommitChanges();
-
- // Find a child in the 'DirectoryEntries' collection which has the
- // specified name and type.
- myEntry2 = myEntries->Find(S"CN=Sample Entry", myDE->SchemaClassName);
- Console::WriteLine ("{0} is found in container.", myEntry2->Name);
- } catch(Exception* e) {
- Console::WriteLine("The following exception was raised : {0}", e->Message);
- }
-}
-
-```
-
+ with error code 0x2030 is thrown.
+
+## Examples
+
+The following example creates a new object with the specified path, then creates a new entry in the container and saves it. It attempts to retrieve the newly created entry.
+
+```vb
+Try
+ Dim myEntry1 As DirectoryEntry
+ Dim myEntry2 As DirectoryEntry
+ Dim strPath As String = "LDAP://DC=fabrikam,DC=com"
+
+ ' Create a 'DirectoryEntry' object with the given path.
+ Dim myDE As New DirectoryEntry(strPath)
+ Dim myEntries As DirectoryEntries = myDE.Children
+
+ ' Create a new entry in the container.
+ myEntry1 = myEntries.Add("CN=Sample Entry", myDE.SchemaClassName)
+ ' Save changes in the 'Active Directory Domain Services' store.
+ myEntry1.CommitChanges()
+
+ ' Find a child in the 'DirectoryEntries' collection which has the
+ ' specified name and type.
+ myEntry2 = myEntries.Find("CN=Sample Entry", myDE.SchemaClassName)
+ Console.WriteLine(myEntry2.Name + " is found in container.")
+
+ Catch e As Exception
+ Console.WriteLine("The following exception was raised : {0}", e.Message.ToString())
+ End Try
+```
+
+```csharp
+using System;
+using System.DirectoryServices;
+
+class MyClass1
+{
+ static void Main()
+ {
+ try
+ {
+ DirectoryEntry myEntry1;
+ DirectoryEntry myEntry2;
+ String strPath = "LDAP://DC=fabrikam,DC=com";
+
+ // Create a 'DirectoryEntry' object with the given path.
+ DirectoryEntry myDE = new DirectoryEntry(strPath);
+ DirectoryEntries myEntries = myDE.Children;
+
+ // Create a new entry in the container.
+ myEntry1 = myEntries.Add("CN=Sample Entry",myDE.SchemaClassName);
+ // Save changes in the 'Active Directory Domain Services' store.
+ myEntry1.CommitChanges();
+
+ // Find a child in the 'DirectoryEntries' collection which has the
+ // specified name and type.
+ myEntry2 = myEntries.Find("CN=Sample Entry",myDE.SchemaClassName);
+ Console.WriteLine (myEntry2.Name + " is found in container.");
+
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("The following exception was raised : {0}",e.Message);
+ }
+ }
+}
+
+```
+
]]>
The Active Directory Domain Services object is not a container.
@@ -391,137 +331,93 @@ int main() {
The name of the object to delete.
Deletes a member of this collection.
- method.
-
-
-
-## Examples
- The following Visual Basic .NET example creates a new object with the specified path, then creates a new entry in the container and saves it. Finally, it retrieves the new entry and deletes it.
-
-```vb
-Imports System
-Imports System.DirectoryServices
-
-Class MyClass1
- Shared Sub Main()
- Try
- Dim strPath As String = "IIS://localhost/W3SVC/1/Root"
- Dim strName As String = ""
-
- ' Create a new 'DirectoryEntry' object with the given path.
- Dim myDE As New DirectoryEntry(strPath)
- Dim myEntries As DirectoryEntries = myDE.Children
-
- ' Create a new entry 'Sample' in the container.
- Dim myDirectoryEntry As DirectoryEntry = myEntries.Add("Sample", myDE.SchemaClassName)
- ' Save changes of entry in the 'Active Directory Domain Services'.
- myDirectoryEntry.CommitChanges()
- Console.WriteLine(myDirectoryEntry.Name + " entry is created in container.")
-
- ' Find 'Sample' entry in container.
- myDirectoryEntry = myEntries.Find("Sample", myDE.SchemaClassName)
- Console.WriteLine(myDirectoryEntry.Name + " found in container.")
- ' Remove 'Sample' entry from container.
- strName = myDirectoryEntry.Name
- myEntries.Remove(myDirectoryEntry)
- Console.WriteLine(strName + " entry is removed from container.")
-
- Catch e As Exception
- Console.WriteLine("The following exception was raised : {0}", e.Message.ToString())
- End Try
- End Sub 'Main
-End Class 'MyClass1
-
-```
-
- The following C# example creates a new object with the specified path, then creates a new entry in the container and saves it. Finally, it retrieves the new entry and deletes it.
-
-```csharp
-using System;
-using System.DirectoryServices;
-
-class MyClass1
-{
- static void Main()
- {
- try
- {
- String strPath = "IIS://localhost/W3SVC/1/Root";
- String strName = "";
-
- // Create a new 'DirectoryEntry' object with the given path.
- DirectoryEntry myDE = new DirectoryEntry(strPath);
- DirectoryEntries myEntries = myDE.Children;
-
- // Create a new entry 'Sample' in the container.
- DirectoryEntry myDirectoryEntry =
- myEntries.Add("Sample", myDE.SchemaClassName);
- // Save changes of entry in the 'Active Directory Domain Services'.
- myDirectoryEntry.CommitChanges();
- Console.WriteLine (myDirectoryEntry.Name +
- " entry is created in container.");
-
- // Find 'Sample' entry in container.
- myDirectoryEntry = myEntries.Find("Sample", myDE.SchemaClassName);
- Console.WriteLine(myDirectoryEntry.Name + " found in container.");
- // Remove 'Sample' entry from container.
- strName = myDirectoryEntry.Name;
- myEntries.Remove(myDirectoryEntry);
- Console.WriteLine(strName+ " entry is removed from container.");
-
- }
- catch(Exception e)
- {
- Console.WriteLine("The following exception was raised : {0}",
- e.Message);
- }
- }
-}
-
-```
-
- The following C++ example creates a new object with the specified path, then creates a new entry in the container and saves it. Finally, it retrieves the new entry and deletes it.
-
-```cpp
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::DirectoryServices;
-
-int main() {
- try {
- String* strPath = S"IIS://localhost/W3SVC/1/Root";
- String* strName = S"";
-
- // Create a new 'DirectoryEntry' object with the given path.
- DirectoryEntry* myDE = new DirectoryEntry(strPath);
- DirectoryEntries* myEntries = myDE->Children;
-
- // Create a new entry 'Sample' in the container.
- DirectoryEntry* myDirectoryEntry = myEntries->Add(S"Sample", myDE->SchemaClassName);
- // Save changes of entry in the 'Active Directory Domain Services'.
- myDirectoryEntry->CommitChanges();
- Console::WriteLine(S"{0} entry is created in container.", myDirectoryEntry->Name);
-
- // Find 'Sample' entry in container.
- myDirectoryEntry = myEntries->Find(S"Sample", myDE->SchemaClassName);
- Console::WriteLine(S"{0} found in container.", myDirectoryEntry->Name);
- // Remove 'Sample' entry from container.
- strName = myDirectoryEntry->Name;
- myEntries->Remove(myDirectoryEntry);
- Console::WriteLine(S"{0} entry is removed from container.", strName);
- } catch(Exception* e) {
- Console::WriteLine(S"The following exception was raised : {0}", e->Message);
- }
-}
-
-```
-
+ method.
+
+## Examples
+ The following example creates a new object with the specified path, then creates a new entry in the container and saves it. Finally, it retrieves the new entry and deletes it.
+
+```vb
+Imports System
+Imports System.DirectoryServices
+
+Class MyClass1
+ Shared Sub Main()
+ Try
+ Dim strPath As String = "IIS://localhost/W3SVC/1/Root"
+ Dim strName As String = ""
+
+ ' Create a new 'DirectoryEntry' object with the given path.
+ Dim myDE As New DirectoryEntry(strPath)
+ Dim myEntries As DirectoryEntries = myDE.Children
+
+ ' Create a new entry 'Sample' in the container.
+ Dim myDirectoryEntry As DirectoryEntry = myEntries.Add("Sample", myDE.SchemaClassName)
+ ' Save changes of entry in the 'Active Directory Domain Services'.
+ myDirectoryEntry.CommitChanges()
+ Console.WriteLine(myDirectoryEntry.Name + " entry is created in container.")
+
+ ' Find 'Sample' entry in container.
+ myDirectoryEntry = myEntries.Find("Sample", myDE.SchemaClassName)
+ Console.WriteLine(myDirectoryEntry.Name + " found in container.")
+ ' Remove 'Sample' entry from container.
+ strName = myDirectoryEntry.Name
+ myEntries.Remove(myDirectoryEntry)
+ Console.WriteLine(strName + " entry is removed from container.")
+
+ Catch e As Exception
+ Console.WriteLine("The following exception was raised : {0}", e.Message.ToString())
+ End Try
+ End Sub 'Main
+End Class 'MyClass1
+
+```
+
+```csharp
+using System;
+using System.DirectoryServices;
+
+class MyClass1
+{
+ static void Main()
+ {
+ try
+ {
+ String strPath = "IIS://localhost/W3SVC/1/Root";
+ String strName = "";
+
+ // Create a new 'DirectoryEntry' object with the given path.
+ DirectoryEntry myDE = new DirectoryEntry(strPath);
+ DirectoryEntries myEntries = myDE.Children;
+
+ // Create a new entry 'Sample' in the container.
+ DirectoryEntry myDirectoryEntry =
+ myEntries.Add("Sample", myDE.SchemaClassName);
+ // Save changes of entry in the 'Active Directory Domain Services'.
+ myDirectoryEntry.CommitChanges();
+ Console.WriteLine (myDirectoryEntry.Name +
+ " entry is created in container.");
+
+ // Find 'Sample' entry in container.
+ myDirectoryEntry = myEntries.Find("Sample", myDE.SchemaClassName);
+ Console.WriteLine(myDirectoryEntry.Name + " found in container.");
+ // Remove 'Sample' entry from container.
+ strName = myDirectoryEntry.Name;
+ myEntries.Remove(myDirectoryEntry);
+ Console.WriteLine(strName+ " entry is removed from container.");
+
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("The following exception was raised : {0}",
+ e.Message);
+ }
+ }
+}
+```
+
]]>
An error occurred during the call to the underlying interface.
@@ -551,11 +447,11 @@ int main() {
Gets the schemas that specify which child objects are contained in the collection.
A that specifies which child objects are contained in the instance.
- property is empty, child objects of all types are visible in the collection; otherwise, only those of the specified types are visible.
-
+ property is empty, child objects of all types are visible in the collection; otherwise, only those of the specified types are visible.
+
]]>
diff --git a/xml/System.DirectoryServices/DirectoryEntry.xml b/xml/System.DirectoryServices/DirectoryEntry.xml
index 89b3f3a102d..da0f8d55c39 100644
--- a/xml/System.DirectoryServices/DirectoryEntry.xml
+++ b/xml/System.DirectoryServices/DirectoryEntry.xml
@@ -153,7 +153,8 @@
object to the directory entry at the specified path, and displays the property of each child entry that is specified by the node's property.
+
+The following example binds a object to the directory entry at the specified path, and displays the property of each child entry that is specified by the node's property.
```vb
Public Class PrintChildren
@@ -197,29 +198,6 @@ public class PrintChildren{
}
```
-```cpp
-int main()
-{
- String^ args[] = Environment::GetCommandLineArgs();
- DirectoryEntry^ objDE;
- String^ strPath = "LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com";
- if(args->Length>1)
- {
- strPath=args[1];
- }
-
- // Create a new DirectoryEntry with the given path.
- objDE = gcnew DirectoryEntry(strPath);
-
- System::Collections::IEnumerator^ enum0 = objDE->Children->GetEnumerator();
- while (enum0->MoveNext())
- {
- DirectoryEntry^ objChildDE = safe_cast(enum0->Current);
- Console::WriteLine(objChildDE->Path);
- }
-}
-```
-
]]>
@@ -697,7 +675,8 @@ int main()
.
+
+The following example takes one argument and determines whether the path corresponds to a valid .
```vb
Dim myADSPath As String = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"
@@ -721,19 +700,6 @@ if (DirectoryEntry.Exists(myADSPath))
{
Console.WriteLine("The path {0} is invalid",myADSPath);
}
-```
-
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-// Determine whether the given path is correct for the DirectoryEntry.
-if (DirectoryEntry::Exists(myADSPath))
-{
- Console::WriteLine("The path {0} is valid", myADSPath);
-}
-else
-{
- Console::WriteLine("The path {0} is invalid", myADSPath);
-}
```
]]>
@@ -783,10 +749,9 @@ else
## Remarks
When binding to an object in Active Directory Domain Services, use the property.
-
-
## Examples
- The following example demonstrates the and properties of the class. This example gets the user-specified and displays its and properties.
+
+The following example demonstrates the and properties of the class. This example gets the user-specified and displays its and properties.
```vb
Dim myADSPath As [String] = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"
@@ -808,16 +773,6 @@ Console.WriteLine("The Native GUID of the ADS"+
"object:"+myDirectoryEntry.NativeGuid);
```
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath);
-
-// Display the Guid and NativeGuid.
-Console::WriteLine("The GUID of the ADS object: {0}", myDirectoryEntry->Guid);
-Console::WriteLine("The Native GUID of the ADS object: {0}",
- myDirectoryEntry->NativeGuid);
-```
-
]]>
@@ -1125,10 +1080,9 @@ Console::WriteLine("The Native GUID of the ADS object: {0}",
## Remarks
This name, along with , distinguishes this entry from its siblings and must be unique among its siblings in each container.
-
-
## Examples
- The following example creates a for the node in the Active Directory Domain Services. It then displays the and properties of its child nodes.
+
+The following example creates a for the node in the Active Directory Domain Services. It then displays the and properties of its child nodes.
```vb
Dim myADSPath As String = "LDAP://onecity/CN=Users,DC=onecity,
@@ -1159,21 +1113,6 @@ foreach(DirectoryEntry myDirectoryEntryChild in
{
Console.WriteLine(myDirectoryEntryChild.Path);
}
-```
-
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath);
-
-Console::WriteLine("DirectoryEntry Name : {0}", myDirectoryEntry->Name);
-Console::WriteLine("\nThe child entries for this node in the Active Directory Domain Services hierarchy");
-
-Collections::IEnumerator^ myEnumerator = myDirectoryEntry->Children->GetEnumerator();
-while (myEnumerator->MoveNext())
-{
- DirectoryEntry^ myDirectoryEntryChild = safe_cast(myEnumerator->Current);
- Console::WriteLine(myDirectoryEntryChild->Path);
-}
```
]]>
@@ -1224,12 +1163,11 @@ while (myEnumerator->MoveNext())
Use the property when binding an object in Active Directory Domain Services.
> [!NOTE]
-> The Lightweight Directory Access Protocol (LDAP) provider returns the globally unique identifier of a in a different format than the Internet Information Services (IIS), Novell NetWare Directory Server (NDS), and WinNT providers.
-
-
+> The Lightweight Directory Access Protocol (LDAP) provider returns the globally unique identifier of a in a different format than the Internet Information Services (IIS), Novell NetWare Directory Server (NDS), and WinNT providers.
## Examples
- The following example demonstrates the and properties of the class. This example gets the user-specified and displays its and properties.
+
+The following example demonstrates the and properties of the class. This example gets the user-specified and displays its and properties.
```vb
Dim myADSPath As [String] = "LDAP://onecity/CN=Users,
@@ -1254,16 +1192,6 @@ Console.WriteLine("The Native GUID of the ADS"+
"object:"+myDirectoryEntry.NativeGuid);
```
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath);
-
-// Display the Guid and NativeGuid.
-Console::WriteLine("The GUID of the ADS object: {0}", myDirectoryEntry->Guid));
-Console::WriteLine("The Native GUID of the ADS object: {0}",
- myDirectoryEntry->NativeGuid);
-```
-
]]>
@@ -1447,7 +1375,8 @@ Console::WriteLine("The Native GUID of the ADS object: {0}",
and displays the and of the result.
+
+The following example searches a given and displays the and of the result.
```vb
Dim myADSPath As String = _
@@ -1462,13 +1391,6 @@ String myADSPath = "LDAP://onecity/CN=user,CN=Users,DC=onecity,DC=corp,DC=fabrik
DirectoryEntry myDirectoryEntry=new DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);
Console.WriteLine("Parent is :"+myDirectoryEntry.Parent.Path);
-```
-
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=user,CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);
-
-Console::WriteLine("Parent is :{0}", myDirectoryEntry->Parent->Path);
```
]]>
@@ -1526,10 +1448,9 @@ Console::WriteLine("Parent is :{0}", myDirectoryEntry->Parent->Path);
## Remarks
You can set the and properties to specify alternate credentials with which to access the information in Active Directory Domain Services. Any other objects retrieved from this instance (for example, through ) are automatically created with the same alternate credentials.
-
-
## Examples
- The following example demonstrates the and properties of the class. This example gets the user-specified and the of all its .
+
+The following example demonstrates the and properties of the class. This example gets the user-specified and the of all its .
```vb
Dim myADSPath As String = _
@@ -1563,25 +1484,6 @@ foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)
Console.WriteLine(myChildDirectoryEntry.Path);
```
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-
-// Create an Instance of DirectoryEntry.
-DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath);
-myDirectoryEntry->Username = UserName;
-myDirectoryEntry->Password = SecurelyStoredPassword;
-
-// Get the Child ADS objects.
-Console::WriteLine("The Child ADS objects are:");
-Collections::IEnumerator^ myEnum = myDirectoryEntry->Children->GetEnumerator();
-while (myEnum->MoveNext())
-{
- DirectoryEntry^ myChildDirectoryEntry = safe_cast
- (myEnum->Current);
- Console::WriteLine(myChildDirectoryEntry->Path);
-}
-```
-
]]>
@@ -1912,10 +1814,9 @@ DirectoryEntry domain = new DirectoryEntry("LDAP://" + str);
A object's schema defines its properties and methods.
-
-
## Examples
- The following example demonstrates the and properties of the class. This example gets the user-specified and gets all of its children if the is a container object. The is a container object if the of that object is "container".
+
+The following example demonstrates the and properties of the class. This example gets the user-specified and gets all of its children if the is a container object. The is a container object if the of that object is "container".
```vb
Dim myADSPath As String = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"
@@ -1953,29 +1854,6 @@ if (string.Compare(mySchemaEntry.Name, "container") == 0)
foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)
Console.WriteLine(myChildDirectoryEntry.Path);
}
-```
-
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-
-// Creates an Instance of DirectoryEntry.
-DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);
-
-// Display the 'SchemaClassName'.
-Console::WriteLine("Schema class name:{0}", myDirectoryEntry->SchemaClassName);
-
-// Gets the SchemaEntry of the ADS Object.
-DirectoryEntry^ mySchemaEntry = myDirectoryEntry->SchemaEntry;
-
-if (!String::Compare(mySchemaEntry->Name, "container"))
-{
- Collections::IEnumerator^ myEnum = myDirectoryEntry->Children->GetEnumerator();
- while (myEnum->MoveNext())
- {
- DirectoryEntry^ myChildDirectoryEntry = safe_cast(myEnum->Current);
- Console::WriteLine(myChildDirectoryEntry->Path);
- }
-}
```
]]>
@@ -2028,10 +1906,9 @@ if (!String::Compare(mySchemaEntry->Name, "container"))
You can use this property to find out what properties and methods are available on the associated object.
-
-
## Examples
- The following example demonstrates the and properties of the class. This example gets the user-specified object and gets all of its children if the object is a container object. The is a container object if the of that object is "container".
+
+The following example demonstrates the and properties of the class. This example gets the user-specified object and gets all of its children if the object is a container object. The is a container object if the of that object is "container".
```vb
Dim myADSPath As String = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"
@@ -2069,29 +1946,6 @@ if (string.Compare(mySchemaEntry.Name,"container") == 0)
foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)
Console.WriteLine(myChildDirectoryEntry.Path);
}
-```
-
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-
-// Creates an Instance of DirectoryEntry.
-DirectoryEntry^ myDirectoryEntry = gcnew DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);
-
-// Display the 'SchemaClassName'.
-Console::WriteLine("Schema class name:{0}", myDirectoryEntry->SchemaClassName);
-
-// Gets the SchemaEntry of the ADS Object*.
-DirectoryEntry^ mySchemaEntry = myDirectoryEntry->SchemaEntry;
-
-if (!String::Compare(mySchemaEntry->Name, S"container"))
-{
- Collections::IEnumerator^ myEnum = myDirectoryEntry->Children->GetEnumerator();
- while (myEnum->MoveNext())
- {
- DirectoryEntry^ myChildDirectoryEntry = safe_cast(myEnum->Current);
- Console::WriteLine(myChildDirectoryEntry->Path);
- }
-}
```
]]>
@@ -2213,10 +2067,9 @@ if (!String::Compare(mySchemaEntry->Name, S"container"))
## Remarks
You can set the and in order to specify alternate credentials with which to access the information in Active Directory Domain Services. Any other objects retrieved from this instance (for example, through ) are automatically created with the same alternate credentials.
-
-
## Examples
- The following example demonstrates the and properties of the class. This example gets the user-specified and the of all its .
+
+The following example demonstrates the and properties of the class. This example gets the user-specified and the of all its .
```vb
Dim myADSPath As String = _
@@ -2249,24 +2102,6 @@ foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)
Console.WriteLine(myChildDirectoryEntry.Path);
```
-```cpp
-String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
-
-// Create an Instance of DirectoryEntry.
-DirectoryEntry^ myDirectoryEntry = new DirectoryEntry(myADSPath);
-myDirectoryEntry->Username = UserName;
-myDirectoryEntry->Password = SecurelyStoredPassword;
-
-// Get the Child ADS objects.
-Console::WriteLine("The Child ADS objects are:");
-Collections::IEnumerator^ myEnum = myDirectoryEntry->Children->GetEnumerator();
-while (myEnum->MoveNext())
-{
- DirectoryEntry^ myChildDirectoryEntry = safe_cast(myEnum->Current);
- Console::WriteLine(myChildDirectoryEntry->Path);
-}
-```
-
]]>
diff --git a/xml/System.DirectoryServices/SearchResult.xml b/xml/System.DirectoryServices/SearchResult.xml
index 67a5da32930..fa784bff2d8 100644
--- a/xml/System.DirectoryServices/SearchResult.xml
+++ b/xml/System.DirectoryServices/SearchResult.xml
@@ -27,207 +27,138 @@
The class encapsulates a node in the Active Directory Domain Services hierarchy that is returned during a search through .
- class are very similar to instances of class. The crucial difference is that the class retrieves its information from the Active Directory Domain Services hierarchy each time a new object is accessed, whereas the data for is already available in the , where it gets returned from a query that is performed with the class. Only those properties that are specified through the collection in your query will be available from .
-
-
-
-## Examples
- The following example creates a new object with the desired path and uses the method to initiate the search. After performing the search, the example uses the method to retrieve the live directory entry identified in the search results.
-
-```vb
-Imports System
-Imports System.DirectoryServices
-Imports Microsoft.VisualBasic
-
-Public Class MySample
- Public Shared Sub Main()
- Dim myLDAPPath As String = ""
- Try
- ' Create a 'DirectoryEntry' object to search.
- Console.WriteLine("Enter the path ( Ex : 'LDAP://MyServer')")
- myLDAPPath = Console.ReadLine()
- Dim mySearchRoot As New DirectoryEntry(myLDAPPath)
-
- Dim myDirectorySearcher As New DirectorySearcher(mySearchRoot)
-
- ' Get the first entry of the search.
- Dim mySearchResult As SearchResult = myDirectorySearcher.FindOne()
- If Not (mySearchResult Is Nothing) Then
- ' Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
- Dim myDirectoryEntry As DirectoryEntry = mySearchResult.GetDirectoryEntry()
- Console.WriteLine(ControlChars.Newline + "The name of the 'myDirectoryEntry' " + _
- "directory entry that corresponds to the " + _
- "'mySearchResult' search result is : {0}" + _
- ControlChars.Newline, myDirectoryEntry.Name)
- Dim mySearchResultPath As String = mySearchResult.Path
- Console.WriteLine("The path for the 'mySearchResult' search result is : {0}" + _
- ControlChars.Newline, mySearchResultPath)
- ' Get the properties of the 'mySearchResult'.
- Dim myResultPropColl As ResultPropertyCollection
- myResultPropColl = mySearchResult.Properties
- Console.WriteLine("The properties of the 'mySearchResult' are :")
- Dim myKey As String
- For Each myKey In myResultPropColl.PropertyNames
- Dim tab1 As String = " "
- Console.WriteLine(myKey + " = ")
- Dim myCollection As Object
- For Each myCollection In myResultPropColl(myKey)
- Console.WriteLine(tab1 + myCollection)
- Next myCollection
- Next myKey
- myDirectoryEntry.Dispose()
- mySearchRoot.Dispose()
- Else
- Console.WriteLine("The '" + myLDAPPath + "' path not found.")
- End If
- Catch e As Exception
- Console.WriteLine("The '" + myLDAPPath + "' path not found.")
- Console.WriteLine("Exception : " & e.Message)
- End Try
- End Sub 'Main
-End Class 'MySample
-```
-
-```csharp
-using System;
-using System.DirectoryServices;
-
-public class MySample
-{
- public static void Main()
- {
- string myLDAPPath = "";
- try
- {
- // Create a 'DirectoryEntry' object to search.
- Console.WriteLine("Enter the path ( Ex : 'LDAP://MyServer')");
- myLDAPPath = Console.ReadLine();
-
- DirectoryEntry mySearchRoot = new DirectoryEntry(myLDAPPath);
- DirectorySearcher myDirectorySearcher =
- new DirectorySearcher(mySearchRoot);
-
- // Get the first entry of the search.
- SearchResult mySearchResult = myDirectorySearcher.FindOne();
-
- if ( mySearchResult != null )
- {
- // Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
- DirectoryEntry myDirectoryEntry =
- mySearchResult.GetDirectoryEntry();
- Console.WriteLine("\nThe name of the 'myDirectoryEntry' " +
- "directory entry that corresponds to the " +
- "'mySearchResult' search result is : {0}\n",
- myDirectoryEntry.Name);
- string mySearchResultPath = mySearchResult.Path;
- Console.WriteLine("The path for the 'mySearchResult' search "
- + "result is : {0}\n", mySearchResultPath);
-
- // Get the properties of the 'mySearchResult'.
- ResultPropertyCollection myResultPropColl;
- myResultPropColl = mySearchResult.Properties;
- Console.WriteLine("The properties of the " +
- "'mySearchResult' are :");
-
- foreach( string myKey in myResultPropColl.PropertyNames)
- {
- string tab = " ";
- Console.WriteLine(myKey + " = ");
- foreach( Object myCollection in myResultPropColl[myKey])
- {
- Console.WriteLine(tab + myCollection);
- }
- }
- mySearchRoot.Dispose();
- myDirectoryEntry.Dispose();
- }
- else
- {
- Console.WriteLine("The '" + myLDAPPath + "' path not found.");
- }
- }
- catch(Exception e)
- {
- Console.WriteLine("The '" + myLDAPPath + "' path not found.");
- Console.WriteLine("Exception : " + e.Message);
- }
- }
-
-}
-```
-
-```cpp
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Collections;
-using namespace System::DirectoryServices;
-using namespace stdcli::language;
-
-int main()
-{
- String^ myLDAPPath = "";
- try
- {
- // Create a 'DirectoryEntry' object to search.
- Console::WriteLine("Enter the path ( Ex : 'LDAP://MyServer')");
- myLDAPPath = Console::ReadLine();
- DirectoryEntry^ mySearchRoot = gcnew DirectoryEntry(myLDAPPath);
-
- DirectorySearcher^ myDirectorySearcher = gcnew DirectorySearcher(mySearchRoot);
-
- // Get the first entry of the search.
- SearchResult^ mySearchResult = myDirectorySearcher->FindOne();
- if (mySearchResult)
- {
- // Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
- DirectoryEntry^ myDirectoryEntry = mySearchResult->GetDirectoryEntry();
- Console::WriteLine(
- String::Concat("\nThe name of the 'myDirectoryEntry' ",
- "directory entry that corresponds to the ",
- "'mySearchResult' search result is : {0}\n"),
- myDirectoryEntry->Name);
-
- String^ mySearchResultPath = mySearchResult->Path;
- Console::WriteLine("The path for the 'mySearchResult' search result is :
- {0}\n", mySearchResultPath);
-
- // Get the properties of the 'mySearchResult'.
- ResultPropertyCollection^ myResultPropColl = mySearchResult->Properties;
- Console::WriteLine("The properties of the 'mySearchResult' are :");
- IEnumerator^ myEnum = myResultPropColl->PropertyNames->GetEnumerator();
- while (myEnum->MoveNext())
- {
- String^ myKey = safe_cast(myEnum->Current);
- Console::WriteLine("{0} = ", myKey);
- IEnumerator^ myEnum = myResultPropColl->Item[myKey]->GetEnumerator();
- while (myEnum->MoveNext())
- {
- Console::WriteLine("\t{0}", myEnum->Current);
- }
- }
- myDirectoryEntry->Dispose();
- mySearchRoot->Dispose();
- }
- else
- {
- Console::WriteLine("The '{0}' path not found.", myLDAPPath);
- }
- }
- catch (Exception^ e)
- {
- Console::WriteLine("The '{0}' path not found.", myLDAPPath);
- Console::WriteLine("Exception : {0}", e->Message);
- }
-}
-
-```
-
+ class are very similar to instances of class. The crucial difference is that the class retrieves its information from the Active Directory Domain Services hierarchy each time a new object is accessed, whereas the data for is already available in the , where it gets returned from a query that is performed with the class. Only those properties that are specified through the collection in your query will be available from .
+
+## Examples
+
+The following example creates a new object with the desired path and uses the method to initiate the search. After performing the search, the example uses the method to retrieve the live directory entry identified in the search results.
+
+```vb
+Imports System
+Imports System.DirectoryServices
+Imports Microsoft.VisualBasic
+
+Public Class MySample
+ Public Shared Sub Main()
+ Dim myLDAPPath As String = ""
+ Try
+ ' Create a 'DirectoryEntry' object to search.
+ Console.WriteLine("Enter the path ( Ex : 'LDAP://MyServer')")
+ myLDAPPath = Console.ReadLine()
+ Dim mySearchRoot As New DirectoryEntry(myLDAPPath)
+
+ Dim myDirectorySearcher As New DirectorySearcher(mySearchRoot)
+
+ ' Get the first entry of the search.
+ Dim mySearchResult As SearchResult = myDirectorySearcher.FindOne()
+ If Not (mySearchResult Is Nothing) Then
+ ' Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
+ Dim myDirectoryEntry As DirectoryEntry = mySearchResult.GetDirectoryEntry()
+ Console.WriteLine(ControlChars.Newline + "The name of the 'myDirectoryEntry' " + _
+ "directory entry that corresponds to the " + _
+ "'mySearchResult' search result is : {0}" + _
+ ControlChars.Newline, myDirectoryEntry.Name)
+ Dim mySearchResultPath As String = mySearchResult.Path
+ Console.WriteLine("The path for the 'mySearchResult' search result is : {0}" + _
+ ControlChars.Newline, mySearchResultPath)
+ ' Get the properties of the 'mySearchResult'.
+ Dim myResultPropColl As ResultPropertyCollection
+ myResultPropColl = mySearchResult.Properties
+ Console.WriteLine("The properties of the 'mySearchResult' are :")
+ Dim myKey As String
+ For Each myKey In myResultPropColl.PropertyNames
+ Dim tab1 As String = " "
+ Console.WriteLine(myKey + " = ")
+ Dim myCollection As Object
+ For Each myCollection In myResultPropColl(myKey)
+ Console.WriteLine(tab1 + myCollection)
+ Next myCollection
+ Next myKey
+ myDirectoryEntry.Dispose()
+ mySearchRoot.Dispose()
+ Else
+ Console.WriteLine("The '" + myLDAPPath + "' path not found.")
+ End If
+ Catch e As Exception
+ Console.WriteLine("The '" + myLDAPPath + "' path not found.")
+ Console.WriteLine("Exception : " & e.Message)
+ End Try
+ End Sub 'Main
+End Class 'MySample
+```
+
+```csharp
+using System;
+using System.DirectoryServices;
+
+public class MySample
+{
+ public static void Main()
+ {
+ string myLDAPPath = "";
+ try
+ {
+ // Create a 'DirectoryEntry' object to search.
+ Console.WriteLine("Enter the path ( Ex : 'LDAP://MyServer')");
+ myLDAPPath = Console.ReadLine();
+
+ DirectoryEntry mySearchRoot = new DirectoryEntry(myLDAPPath);
+ DirectorySearcher myDirectorySearcher =
+ new DirectorySearcher(mySearchRoot);
+
+ // Get the first entry of the search.
+ SearchResult mySearchResult = myDirectorySearcher.FindOne();
+
+ if ( mySearchResult != null )
+ {
+ // Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
+ DirectoryEntry myDirectoryEntry =
+ mySearchResult.GetDirectoryEntry();
+ Console.WriteLine("\nThe name of the 'myDirectoryEntry' " +
+ "directory entry that corresponds to the " +
+ "'mySearchResult' search result is : {0}\n",
+ myDirectoryEntry.Name);
+ string mySearchResultPath = mySearchResult.Path;
+ Console.WriteLine("The path for the 'mySearchResult' search "
+ + "result is : {0}\n", mySearchResultPath);
+
+ // Get the properties of the 'mySearchResult'.
+ ResultPropertyCollection myResultPropColl;
+ myResultPropColl = mySearchResult.Properties;
+ Console.WriteLine("The properties of the " +
+ "'mySearchResult' are :");
+
+ foreach( string myKey in myResultPropColl.PropertyNames)
+ {
+ string tab = " ";
+ Console.WriteLine(myKey + " = ");
+ foreach( Object myCollection in myResultPropColl[myKey])
+ {
+ Console.WriteLine(tab + myCollection);
+ }
+ }
+ mySearchRoot.Dispose();
+ myDirectoryEntry.Dispose();
+ }
+ else
+ {
+ Console.WriteLine("The '" + myLDAPPath + "' path not found.");
+ }
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("The '" + myLDAPPath + "' path not found.");
+ Console.WriteLine("Exception : " + e.Message);
+ }
+ }
+
+}
+```
+
]]>
@@ -257,50 +188,38 @@ int main()
Retrieves the that corresponds to the from the Active Directory Domain Services hierarchy.
The that corresponds to the .
- when you want to look at the live entry instead of the entry that was returned through , or when you want to invoke a method on the object that was returned.
-
+ when you want to look at the live entry instead of the entry that was returned through , or when you want to invoke a method on the object that was returned.
+
> [!NOTE]
-> Calling on each returned through can be slow.
-
-
-
-## Examples
- The following example is an excerpt of the example in . The original example creates a new object with the desired path and uses the method to initiate the search. After performing the search, the example uses the method to retrieve the live directory entry that is identified in the search results.
-
-```vb
-' Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
-Dim myDirectoryEntry As DirectoryEntry = mySearchResult.GetDirectoryEntry()
-Console.WriteLine(ControlChars.Newline + "The name of the 'myDirectoryEntry' " + _
- "directory entry that corresponds to the " + _
- "'mySearchResult' search result is : {0}" + _
- ControlChars.Newline, myDirectoryEntry.Name)
-
-```
-
-```csharp
-// Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
-DirectoryEntry myDirectoryEntry =
- mySearchResult.GetDirectoryEntry();
-Console.WriteLine("\nThe name of the 'myDirectoryEntry' " +
- "directory entry that corresponds to the " +
- "'mySearchResult' search result is : {0}\n",
- myDirectoryEntry.Name);
-
-```
-
-```cpp
-// Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
-DirectoryEntry^ myDirectoryEntry = mySearchResult->GetDirectoryEntry();
-Console::WriteLine(
- String::Concat("\nThe name of the 'myDirectoryEntry' ",
- "directory entry that corresponds to the ",
- "'mySearchResult' search result is : {0}\n"),
- myDirectoryEntry->Name);
-```
-
+> Calling on each returned through can be slow.
+
+## Examples
+
+The following example is an excerpt of the example in . The original example creates a new object with the desired path and uses the method to initiate the search. After performing the search, the example uses the method to retrieve the live directory entry that is identified in the search results.
+
+```vb
+' Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
+Dim myDirectoryEntry As DirectoryEntry = mySearchResult.GetDirectoryEntry()
+Console.WriteLine(ControlChars.Newline + "The name of the 'myDirectoryEntry' " + _
+ "directory entry that corresponds to the " + _
+ "'mySearchResult' search result is : {0}" + _
+ ControlChars.Newline, myDirectoryEntry.Name)
+```
+
+```csharp
+// Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
+DirectoryEntry myDirectoryEntry =
+ mySearchResult.GetDirectoryEntry();
+Console.WriteLine("\nThe name of the 'myDirectoryEntry' " +
+ "directory entry that corresponds to the " +
+ "'mySearchResult' search result is : {0}\n",
+ myDirectoryEntry.Name);
+```
+
]]>
@@ -329,37 +248,30 @@ Console::WriteLine(
Gets the path for this .
The path of this .
- property uniquely identifies this entry in the Active Directory Domain Services hierarchy. The entry can always be retrieved using this path.
-
-
-
-## Examples
- The following example is an excerpt of the example in . The original example creates a new object with the desired path and uses the method to initiate the search. After performing the search, the example uses the method to retrieve the live directory entry that is identified in the search results.
-
- This example shows how to parse the property from the search result.
-
-```vb
-Dim mySearchResultPath As String = mySearchResult.Path
-Console.WriteLine("The path for the 'mySearchResult' search result is : {0}" + _
- ControlChars.Newline, mySearchResultPath)
-
-```
-
-```csharp
-string mySearchResultPath = mySearchResult.Path;
-Console.WriteLine("The path for the 'mySearchResult' search "
- + "result is : {0}\n", mySearchResultPath);
-```
-
-```cpp
-String^ mySearchResultPath = mySearchResult->Path;
-Console::WriteLine("The path for the 'mySearchResult' search result is : {0}\n", mySearchResultPath);
-
-```
-
+ property uniquely identifies this entry in the Active Directory Domain Services hierarchy. The entry can always be retrieved using this path.
+
+## Examples
+
+The following example is an excerpt of the example in . The original example creates a new object with the desired path and uses the method to initiate the search. After performing the search, the example uses the method to retrieve the live directory entry that is identified in the search results.
+
+This example shows how to parse the property from the search result.
+
+```vb
+Dim mySearchResultPath As String = mySearchResult.Path
+Console.WriteLine("The path for the 'mySearchResult' search result is : {0}" + _
+ ControlChars.Newline, mySearchResultPath)
+```
+
+```csharp
+string mySearchResultPath = mySearchResult.Path;
+Console.WriteLine("The path for the 'mySearchResult' search "
+ + "result is : {0}\n", mySearchResultPath);
+```
+
]]>
@@ -388,71 +300,51 @@ Console::WriteLine("The path for the 'mySearchResult' search result is : {0}\n",
Gets a collection of properties for this object.
A of properties set on this object.
- .
-
-
-
-## Examples
- The following example is an excerpt of the example in . The original example creates a new object with the desired path and uses the method to initiate the search. After performing the search, the example uses the method to retrieve the live directory entry that is identified in the search results.
-
- In this example, the search result is put into a . Then, each property is displayed to the console window.
-
-```vb
-' Get the properties for 'mySearchResult'.
-Dim myResultPropColl As ResultPropertyCollection
-myResultPropColl = mySearchResult.Properties
-Console.WriteLine("The properties of the 'mySearchResult' are :")
-Dim myKey As String
-For Each myKey In myResultPropColl.PropertyNames
- Dim tab1 As String = " "
- Console.WriteLine(myKey + " = ")
- Dim myCollection As Object
- For Each myCollection In myResultPropColl(myKey)
- Console.WriteLine(tab1 + myCollection)
- Next myCollection
-Next myKey
-
-```
-
-```csharp
-// Get the properties for 'mySearchResult'.
-ResultPropertyCollection myResultPropColl;
-myResultPropColl = mySearchResult.Properties;
-Console.WriteLine("The properties of the " +
- "'mySearchResult' are :");
-foreach( string myKey in myResultPropColl.PropertyNames)
-{
- string tab = " ";
- Console.WriteLine(myKey + " = ");
- foreach( Object myCollection in myResultPropColl[myKey])
- {
- Console.WriteLine(tab + myCollection);
- }
-}
-
-```
-
-```cpp
-// Get the properties for 'mySearchResult'.
-ResultPropertyCollection^ myResultPropColl = mySearchResult->Properties;
-Console::WriteLine("The properties of the 'mySearchResult' are :");
-IEnumerator^ myEnum = myResultPropColl->PropertyNames->GetEnumerator();
-while (myEnum->MoveNext())
-{
- String^ myKey = safe_cast(myEnum->Current);
- Console::WriteLine("{0} = ", myKey);
- IEnumerator^ myEnum = myResultPropColl->Item[myKey]->GetEnumerator();
- while (myEnum->MoveNext())
- {
- Console::WriteLine("\t{0}", myEnum->Current);
- }
-}
-
-```
-
+ .
+
+## Examples
+
+The following example is an excerpt of the example in . The original example creates a new object with the desired path and uses the method to initiate the search. After performing the search, the example uses the method to retrieve the live directory entry that is identified in the search results.
+
+In this example, the search result is put into a . Then, each property is displayed to the console window.
+
+```vb
+' Get the properties for 'mySearchResult'.
+Dim myResultPropColl As ResultPropertyCollection
+myResultPropColl = mySearchResult.Properties
+Console.WriteLine("The properties of the 'mySearchResult' are :")
+Dim myKey As String
+For Each myKey In myResultPropColl.PropertyNames
+ Dim tab1 As String = " "
+ Console.WriteLine(myKey + " = ")
+ Dim myCollection As Object
+ For Each myCollection In myResultPropColl(myKey)
+ Console.WriteLine(tab1 + myCollection)
+ Next myCollection
+Next myKey
+```
+
+```csharp
+// Get the properties for 'mySearchResult'.
+ResultPropertyCollection myResultPropColl;
+myResultPropColl = mySearchResult.Properties;
+Console.WriteLine("The properties of the " +
+ "'mySearchResult' are :");
+foreach( string myKey in myResultPropColl.PropertyNames)
+{
+ string tab = " ";
+ Console.WriteLine(myKey + " = ");
+ foreach( Object myCollection in myResultPropColl[myKey])
+ {
+ Console.WriteLine(tab + myCollection);
+ }
+}
+```
+
]]>
diff --git a/xml/System.IO/Directory.xml b/xml/System.IO/Directory.xml
index 3d820f957cc..22e38ef0653 100644
--- a/xml/System.IO/Directory.xml
+++ b/xml/System.IO/Directory.xml
@@ -208,23 +208,23 @@
object for the existing directory.
- The `path` parameter specifies a directory path, not a file path.
+Any and all directories specified in `path` are created, unless they already exist or unless some part of `path` is invalid. If the directory already exists, this method does not create a new directory, but it returns a object for the existing directory.
- Trailing spaces are removed from the end of the `path` parameter before creating the directory.
+The `path` parameter specifies a directory path, not a file path.
- You can create a directory on a remote computer, on a share that you have write access to. UNC paths are supported; for example, you can specify the following for `path`: `\\2009\Archives\December` in Visual Basic, and `\\\\2009\\Archives\\December` in C#.
+Trailing spaces are removed from the end of the `path` parameter before creating the directory.
- Creating a directory with only the colon character (:) is not supported, and will cause a `NotSupportedException` to be thrown.
+You can create a directory on a remote computer, on a share that you have write access to. UNC paths are supported; for example, you can specify the following for `path`: `\\2009\Archives\December` in Visual Basic, and `\\\\2009\\Archives\\December` in C#.
- On Unix systems, use a forward slash (/) as path separator.
+Creating a directory with only the colon character (:) is not supported, and will cause a `NotSupportedException` to be thrown.
+
+On Unix systems, use a forward slash (/) as path separator.
## Examples
The following example creates and deletes the specified directory:
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/Directory/CreateDirectory/dir_createdir.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/Directory/CreateDirectory/dir_createdir.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Dir_CreateDir/VB/dir_createdir.vb" id="Snippet1":::
@@ -241,12 +241,6 @@ Directory.CreateDirectory("c:\Users\User1\Public\Html")
Directory.CreateDirectory("Public\\Html");
Directory.CreateDirectory("\\Users\\User1\\Public\\Html");
Directory.CreateDirectory("c:\\Users\\User1\\Public\\Html");
-```
-
-```cpp
-Directory::CreateDirectory("Public\\Html");
-Directory::CreateDirectory("\\Users\\User1\\Public\\Html");
-Directory::CreateDirectory("c:\\Users\\User1\\Public\\Html");
```
]]>
@@ -983,7 +977,7 @@ An I/O error occurred.
was associated with a .
```vb
-' Example for closing the NetworkStream.
' Close the NetworkStream
myNetworkStream.Close()
```
```csharp
-// Example for closing the NetworkStream.
-
// Close the NetworkStream
myNetworkStream.Close();
```
```cpp
-// Example for closing the NetworkStream.
// Close the NetworkStream
myNetworkStream->Close();
```
diff --git a/xml/System.Reflection/MethodInfo.xml b/xml/System.Reflection/MethodInfo.xml
index 65c54d56701..e2688c1827d 100644
--- a/xml/System.Reflection/MethodInfo.xml
+++ b/xml/System.Reflection/MethodInfo.xml
@@ -969,19 +969,17 @@ End Class
represents a generic method definition, then:
- `IsGenericMethodDefinition` returns `true`.
-
- For each object in the array returned by the method:
- The property returns `true`.
-
- The returns the current .
-
- The property is the same as the position of the object in the array.
-Use the `IsGenericMethodDefinition` property to determine whether type arguments have been assigned to the type parameters of a generic method. If type arguments have been assigned, the `IsGenericMethodDefinition` property returns false even if some of the type arguments are objects that represent type parameters of enclosing types. For example, consider the following C\#, Visual Basic, and C++ code:
+Use the `IsGenericMethodDefinition` property to determine whether type arguments have been assigned to the type parameters of a generic method. If type arguments have been assigned, the `IsGenericMethodDefinition` property returns false even if some of the type arguments are objects that represent type parameters of enclosing types. For example, consider the following code:
```csharp
class C
@@ -1023,8 +1021,7 @@ The method body of M contains a call to method N, specifying the type parameter
> [!NOTE]
> Although the open constructed method `N` is not encountered when reflecting over class C, it must be generated using in order to emit C as a dynamic class.
-
-If a generic method definition includes generic parameters of the declaring type, there will be a generic method definition specific to each constructed type. For example, consider the following C\# and Visual Basic code:
+If a generic method definition includes generic parameters of the declaring type, there will be a generic method definition specific to each constructed type. For example, consider the following code:
```csharp
class B {}
@@ -1055,6 +1052,7 @@ In the constructed type `C` (`C(Of Integer)` in Visual Basic), the generic
For a list of the invariant conditions for terms specific to generic methods, see the property. For a list of the invariant conditions for other terms used in generic reflection, see the property.
## Examples
+
The following code example uses the `IsGenericMethodDefinition` property to display a message indicating whether a represents a generic method definition.
This example is part of a larger example provided for the method.
diff --git a/xml/System.Resources/ResourceReader.xml b/xml/System.Resources/ResourceReader.xml
index f428932badb..0e46d4666de 100644
--- a/xml/System.Resources/ResourceReader.xml
+++ b/xml/System.Resources/ResourceReader.xml
@@ -733,9 +733,11 @@ Label11="Mobile Phone:"
to be reallocated for other purposes. For more information about Dispose, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged).
## Examples
+
The following code example moves through a file's resources and prints out all the key/value pairs it finds. The code then uses theIDisposable.Dispose method to shut down the and to release all resources used by it.
```vb
@@ -743,27 +745,27 @@ Imports System
Imports System.Resources
Imports System.Collections
-Public Class ReadResources
+Public Class ReadResources
- Public Shared Sub Main(args() As String)
- ' Create a resource reader for items.resources
- ' and get an enumerator to iterate through the file.
+ Public Shared Sub Main(args() As String)
+ ' Create a resource reader for items.resources
+ ' and get an enumerator to iterate through the file.
Dim reader As IResourceReader = New ResourceReader("items.resources")
Dim en As IDictionaryEnumerator = reader.GetEnumerator()
- ' Iterate through the file, printing the key and value pairs.
+ ' Iterate through the file, printing the key and value pairs.
While en.MoveNext()
Console.WriteLine()
Console.WriteLine("Name: {0}", en.Key)
Console.WriteLine("Value: {0}", en.Value)
- End While
+ End While
- ' Clean up all resources associated with the reader.
+ ' Clean up all resources associated with the reader.
' Calling Dispose is equivalent to calling Close.
reader.Dispose()
- End Sub
+ End Sub
-End Class
+End Class
```
```csharp
@@ -771,16 +773,16 @@ using System;
using System.Resources;
using System.Collections;
-public class ReadResources
+public class ReadResources
{
- public static void Main(string[] args)
+ public static void Main(string[] args)
{
- // Create a resource reader for items.resources
+ // Create a resource reader for items.resources
// and get an enumerator to iterate through the file.
IResourceReader reader = new ResourceReader("items.resources");
IDictionaryEnumerator en = reader.GetEnumerator();
- // Iterate through the file, printing the key/value pairs.
+ // Iterate through the file, printing the key/value pairs.
while (en.MoveNext())
{
Console.WriteLine();
@@ -788,7 +790,7 @@ public class ReadResources
Console.WriteLine("Value: {0}", en.Value);
}
- // Clean up all resources associated with the reader.
+ // Clean up all resources associated with the reader.
// Calling Dispose is equivalent to calling Close.
reader.Dispose();
}
@@ -796,19 +798,19 @@ public class ReadResources
```
```cpp
-using namespace System;
-using namespace System::Resources;
-using namespace System::Collections;
+using namespace System;
+using namespace System::Resources;
+using namespace System::Collections;
int main()
{
array^args = Environment::GetCommandLineArgs();
- // Create a resource reader for items.resources
+ // Create a resource reader for items.resources
// and get an enumerator to iterate through the file.
IResourceReader^ reader = gcnew ResourceReader( "items.resources" );
IDictionaryEnumerator^ en = reader->GetEnumerator();
- // Iterate through the file, printing the key/value pairs.
+ // Iterate through the file, printing the key/value pairs.
while ( en->MoveNext() )
{
Console::WriteLine();
@@ -816,7 +818,7 @@ int main()
Console::WriteLine( "Value: {0}", en->Value );
}
- // Clean up all resources associated with the reader.
+ // Clean up all resources associated with the reader.
// Calling the destructor is equivalent to calling Close.
reader->~IResourceReader();
}
diff --git a/xml/System.Runtime.InteropServices/SEHException.xml b/xml/System.Runtime.InteropServices/SEHException.xml
index db8696eed8f..18fd9d90ab2 100644
--- a/xml/System.Runtime.InteropServices/SEHException.xml
+++ b/xml/System.Runtime.InteropServices/SEHException.xml
@@ -75,21 +75,18 @@
class handles SEH errors that are thrown from unmanaged code, but that have not been mapped to another .NET Framework exception. The class also corresponds to the `HRESULT` `E_FAIL` (0x80004005).
- The .NET Framework often encounters unmanaged SEH exceptions that are automatically mapped to managed equivalents. There are two common unmanaged SEH exceptions:
+The class handles SEH errors that are thrown from unmanaged code, but that have not been mapped to another .NET Framework exception. The class also corresponds to the `HRESULT` `E_FAIL` (0x80004005).
-- `STATUS_NO_MEMORY` exceptions are automatically mapped to the class.
+.NET often encounters unmanaged SEH exceptions that are automatically mapped to managed equivalents. There are two common unmanaged SEH exceptions:
-- `STATUS_ACCESS_VIOLATION` exceptions are automatically mapped as follows:
+- `STATUS_NO_MEMORY` exceptions are automatically mapped to the class.
+- `STATUS_ACCESS_VIOLATION` exceptions are automatically mapped as follows:
- - If `legacyNullReferencePolicy` is applied, all access violations are mapped to the class.
-
- - If the address at which the read/write was attempted is not in JIT-compiled code, the exception is mapped to the class.
-
- - If the address at which the read/write was attempted is in JIT-compiled code, but it is not in the OS Null partition area, the exception is mapped to the class.
-
- - If there is no `legacyNullReferencePolicy`, and the address at which the read/write was attempted is in JIT-compiled code and in the OS Null partition area, the exception is mapped to the class.
+ - If `legacyNullReferencePolicy` is applied, all access violations are mapped to the class.
+ - If the address at which the read/write was attempted is not in JIT-compiled code, the exception is mapped to the class.
+ - If the address at which the read/write was attempted is in JIT-compiled code, but it is not in the OS Null partition area, the exception is mapped to the class.
+ - If there is no `legacyNullReferencePolicy`, and the address at which the read/write was attempted is in JIT-compiled code and in the OS Null partition area, the exception is mapped to the class.
Any SEH exception that is not automatically mapped to a specific exception is mapped to the class by default.
diff --git a/xml/System.Threading/Timer.xml b/xml/System.Threading/Timer.xml
index c43052f9028..6f758f56efc 100644
--- a/xml/System.Threading/Timer.xml
+++ b/xml/System.Threading/Timer.xml
@@ -94,13 +94,10 @@
delegate to specify the method you want the to execute. The signature of the delegate is:
-```csharp
-void TimerCallback(Object state)
-```
+Use a delegate to specify the method you want the to execute. The signature of the delegate is:
-```cpp
+```csharp
void TimerCallback(Object state)
```
@@ -108,7 +105,7 @@ void TimerCallback(Object state)
Sub TimerCallback(state As Object)
```
- The timer delegate is specified when the timer is constructed, and cannot be changed. The method does not execute on the thread that created the timer; it executes on a thread supplied by the system.
+The timer delegate is specified when the timer is constructed and cannot be changed. The method does not execute on the thread that created the timer; it executes on a thread supplied by the system.
> [!TIP]
> .NET includes several timer classes, each of which offers different functionality:
@@ -122,32 +119,30 @@ Sub TimerCallback(state As Object)
When you create a timer, you can specify an amount of time to wait before the first execution of the method (due time), and an amount of time to wait between subsequent executions (period). The class has the same resolution as the system clock. This means that if the period is less than the resolution of the system clock, the delegate will execute at intervals defined by the resolution of the system clock, which is approximately 15 milliseconds on Windows 7 and Windows 8 systems. You can change the due time and period, or disable the timer, by using the method.
> [!NOTE]
-> As long as you are using a , you must keep a reference to it. As with any managed object, a is subject to garbage collection when there are no references to it. The fact that a is still active does not prevent it from being collected.
+> As long as you are using a , you must keep a reference to it. As with any managed object, a is subject to garbage collection when there are no references to it. The fact that a is still active does not prevent it from being collected.
> [!NOTE]
-> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
+> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
When a timer is no longer needed, use the method to free the resources held by the timer. Note that callbacks can occur after the method overload has been called, because the timer queues callbacks for execution by thread pool threads. You can use the method overload to wait until all callbacks have completed.
The callback method executed by the timer should be reentrant, because it is called on threads. The callback can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the callback, or if all thread pool threads are in use and the callback is queued multiple times.
> [!NOTE]
-> is a simple, lightweight timer that uses callback methods and is served by thread pool threads. It is not recommended for use with Windows Forms, because its callbacks do not occur on the user interface thread. is a better choice for use with Windows Forms. For server-based timer functionality, you might consider using , which raises events and has additional features.
-
-
+> is a simple, lightweight timer that uses callback methods and is served by thread pool threads. It is not recommended for use with Windows Forms, because its callbacks do not occur on the user interface thread. is a better choice for use with Windows Forms. For server-based timer functionality, you might consider using , which raises events and has additional features.
## Examples
- The following example defines a `StatusChecker` class that includes a `CheckStatus` method whose signature is the same as the delegate. The `state` argument of the `CheckStatus` method is an object that is used to synchronize the application thread and the thread pool thread that executes the callback delegate. The `StatusChecker` class also includes two state variables:
- `invokeCount`
+The following example defines a `StatusChecker` class that includes a `CheckStatus` method whose signature is the same as the delegate. The `state` argument of the `CheckStatus` method is an object that is used to synchronize the application thread and the thread pool thread that executes the callback delegate. The `StatusChecker` class also includes two state variables:
+
+ `invokeCount`\
Indicates the number of times the callback method has been invoked.
- `maxCount`
+ `maxCount`\
Determines the maximum number of times the callback method should be invoked.
The application thread creates the timer, which waits one second and then executes the `CheckStatus` callback method every 250 milliseconds. The application thread then blocks until the object is signaled. When the `CheckStatus` callback method executes `maxCount` times, it calls the `AutoResetEvent.Set` method to set the state of the object to signaled. The first time this happens, the application thread calls the method so that the callback method now executes every half second. It once again blocks until the object is signaled. When this happens, the timer is destroyed by calling its method, and the application terminates.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Threading/Timer/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Threading.Timer/VB/source.vb" id="Snippet1":::
diff --git a/xml/System.Windows.Forms/BindingContext.xml b/xml/System.Windows.Forms/BindingContext.xml
index f341090e010..94b9d2791b0 100644
--- a/xml/System.Windows.Forms/BindingContext.xml
+++ b/xml/System.Windows.Forms/BindingContext.xml
@@ -61,10 +61,6 @@ TextBox1.DataBindings.Add("Text", dataSet1, "Customers.FirstName")
```csharp
textBox1.DataBindings.Add("Text", dataSet1, "Customers.FirstName");
-```
-
-```cpp
-textBox1->DataBindings->Add("Text", dataSet1, "Customers.FirstName");
```
You can add a second control (`TextBox2`) to the form and bind it to the `LastName` column of the `Customers` table in the same dataset. The is aware of the first binding (`TextBox1` to `Customers.FirstName`), so it would use the same , as both text boxes are bound to the same dataset (`DataSet1`).
@@ -75,10 +71,6 @@ TextBox2.DataBindings.Add("Text", dataSet1, "Customers.LastName")
```csharp
textBox2.DataBindings.Add("Text", dataSet1, "Customers.LastName");
-```
-
-```cpp
-textBox2->DataBindings->Add("Text", dataSet1, "Customers.LastName");
```
If you bind `TextBox2` to a different dataset, the creates and manages a second .
@@ -97,12 +89,6 @@ comboBox1.DisplayMember = "Customers.FirstName";
this.BindingContext[dataSet1, "Customers"].Position = 1;
```
-```cpp
-comboBox1->DataSource = dataSet1;
-comboBox1->DisplayMember = "Customers.FirstName";
-this->BindingContext->get_Item(dataSet1, "Customers")->Position = 1;
-```
-
```vb
ComboBox1.DataSource = DataSet1.Customers
ComboBox1.DisplayMember = "FirstName"
@@ -115,16 +101,8 @@ comboBox1.DisplayMember = "FirstName";
this.BindingContext[dataSet1.Customers].Position = 1;
```
-```cpp
-comboBox1->DataSource = dataSet1->Customers;
-comboBox1->DisplayMember = "FirstName";
-this->BindingContext->get_Item(dataSet1->Customers)->Position = 1;
-```
-
> [!NOTE]
-> Most Windows Forms applications bind through a . The component encapsulates a and exposes the programming interface. When using a for binding, you should use the members exposed by the to manipulate "currency" (that is, `Position`) rather than go through the .
-
-
+> Most Windows Forms applications bind through a . The component encapsulates a and exposes the programming interface. When using a for binding, you should use the members exposed by the to manipulate "currency" (that is, `Position`) rather than go through the .
## Examples
The following code example creates four objects to bind five controls - a and four controls - to several data sources. The is then used to get the for each data source.
diff --git a/xml/System.Windows.Forms/MessageBoxIcon.xml b/xml/System.Windows.Forms/MessageBoxIcon.xml
index bb41c2063cc..9002e79d8fb 100644
--- a/xml/System.Windows.Forms/MessageBoxIcon.xml
+++ b/xml/System.Windows.Forms/MessageBoxIcon.xml
@@ -23,84 +23,68 @@
Specifies constants defining which information to display.
- class. The description of each member of this enumeration contains a typical representation of the symbol. The actual graphic displayed is a function of the operating system constants. In current implementations there are four unique symbols with multiple values assigned to them.
-
- The following table shows the different message box icons.
-
-|Icon|Name|
-|-|-|
-||Hand|
-||Question|
-||Exclamation|
-||Asterisk|
-||Stop|
-||Error|
-||Warning|
-||Information|
-
-
-
-## Examples
- The following code example shows how to use a to inform the user of a missing entry in a . This example requires that the method is called from an existing form with a and a on it.
-
-```csharp
-private void Form1_FormClosing(object sender, FormClosingEventArgs e)
-{
- const string message =
- "Are you sure that you would like to close the form?";
- const string caption = "Form Closing";
- var result = MessageBox.Show(message, caption,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Exclamation);
-
- // If the no button was pressed ...
- if (result == DialogResult.No)
- {
- // cancel the closure of the form.
- e.Cancel = true;
- }
-}
-```
-
-```cpp
-private:
- void Form1_FormClosing(Object^ sender, FormClosingEventArgs^ e)
- {
- // If the no button was pressed ...
- if ((MessageBox::Show(
- "Are you sure that you would like to close the form?",
- "Form Closing", MessageBoxButtons::YesNo,
- MessageBoxIcon::Exclamation) == DialogResult::No))
- {
- // cancel the closure of the form.
- e->Cancel = true;
- }
- }
-```
-
-```vb
-Private Sub Form1_FormClosing( _
- ByVal sender As System.Object, _
- ByVal e As System.Windows.Forms.FormClosingEventArgs) _
- Handles MyBase.FormClosing
-
- Dim message As String = _
- "Are you sure that you would like to close the form?"
- Dim caption As String = "Form Closing"
- Dim result = MessageBox.Show(message, caption, _
- MessageBoxButtons.YesNo, _
- MessageBoxIcon.Exclamation)
-
- ' If the no button was pressed ...
- If (result = DialogResult.No) Then
- ' cancel the closure of the form.
- e.Cancel = True
- End If
-End Sub
-```
+ class. The description of each member of this enumeration contains a typical representation of the symbol. The actual graphic displayed is a function of the operating system constants. In current implementations there are four unique symbols with multiple values assigned to them.
+
+The following table shows the different message box icons.
+
+| Icon | Name |
+|-----------------------------------------------------------------------------------|------|
+|  | Hand |
+|  | Question |
+|  | Exclamation |
+|  | Asterisk |
+|  | Stop |
+|  | Error |
+|  | Warning |
+|  | Information |
+
+## Examples
+
+The following code example shows how to use a to inform the user of a missing entry in a . This example requires that the method is called from an existing form with a and a on it.
+
+```csharp
+private void Form1_FormClosing(object sender, FormClosingEventArgs e)
+{
+ const string message =
+ "Are you sure that you would like to close the form?";
+ const string caption = "Form Closing";
+ var result = MessageBox.Show(message, caption,
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Exclamation);
+
+ // If the no button was pressed ...
+ if (result == DialogResult.No)
+ {
+ // cancel the closure of the form.
+ e.Cancel = true;
+ }
+}
+```
+
+```vb
+Private Sub Form1_FormClosing( _
+ ByVal sender As System.Object, _
+ ByVal e As System.Windows.Forms.FormClosingEventArgs) _
+ Handles MyBase.FormClosing
+
+ Dim message As String = _
+ "Are you sure that you would like to close the form?"
+ Dim caption As String = "Form Closing"
+ Dim result = MessageBox.Show(message, caption, _
+ MessageBoxButtons.YesNo, _
+ MessageBoxIcon.Exclamation)
+
+ ' If the no button was pressed ...
+ If (result = DialogResult.No) Then
+ ' cancel the closure of the form.
+ e.Cancel = True
+ End If
+End Sub
+```
]]>