diff --git a/add/media/aboutgdip05-art10.gif b/add/media/aboutgdip05-art10.gif
deleted file mode 100644
index 5853ca9cbb3..00000000000
Binary files a/add/media/aboutgdip05-art10.gif and /dev/null differ
diff --git a/add/media/aboutgdip05-art12.gif b/add/media/aboutgdip05-art12.gif
deleted file mode 100644
index 140c14f3cca..00000000000
Binary files a/add/media/aboutgdip05-art12.gif and /dev/null differ
diff --git a/xml/System.Collections.Generic/HashSet`1.xml b/xml/System.Collections.Generic/HashSet`1.xml
index 7a320edfb99..7a863c08386 100644
--- a/xml/System.Collections.Generic/HashSet`1.xml
+++ b/xml/System.Collections.Generic/HashSet`1.xml
@@ -127,69 +127,15 @@
The type of elements in the hash set.
Represents a set of values.
-
- class provides high-performance set operations. A set is a collection that contains no duplicate elements, and whose elements are in no particular order.
-
-> [!NOTE]
-> implements the interface starting with the .NET Framework 4.6; in previous versions of the .NET Framework, the class did not implement this interface.
-
- The capacity of a object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
-
- The class is based on the model of mathematical sets and provides high-performance set operations similar to accessing the keys of the or collections. In simple terms, the class can be thought of as a collection without values.
-
- A collection is not sorted and cannot contain duplicate elements. If order or element duplication is more important than performance for your application, consider using the class together with the method.
-
- provides many mathematical set operations, such as set addition (unions) and set subtraction. The following table lists the provided operations and their mathematical equivalents.
-
-|HashSet operation|Mathematical equivalent|
-|-------------------------------|-----------------------------|
-||Union or set addition|
-||Intersection|
-||Set subtraction|
-||Symmetric difference|
-
- In addition to the listed set operations, the class also provides methods for determining set equality, overlap of sets, and whether a set is a subset or superset of another set.
-
-**.NET Framework only:** For very large objects, you can increase the maximum capacity to 2 billion elements on a 64-bit system by setting the `enabled` attribute of the [``](/dotnet/framework/configure-apps/file-schema/runtime/gcallowverylargeobjects-element) configuration element to `true` in the run-time environment.
-
- Starting with the .NET Framework 4, the class implements the interface.
-
-## HashSet and LINQ Set Operations
- LINQ provides access to the `Distinct`, `Union`, `Intersect` and `Except` set operations on any data source that implements the or interfaces. provides a larger and more robust collection of set operations. For example, provides comparisons such as and .
-
- The primary difference between LINQ set operations and operations is that LINQ set operations always return a new collection, whereas the equivalent methods modify the current collection.
-
- Typically, if you must create a new set or if your application needs access only to the provided set operations, using LINQ set operations on any collection or array will be sufficient. However, if your application requires access to additional set operations, or if it is not desirable or necessary to create a new collection, use the class.
-
- The following table shows the operations and their equivalent LINQ set operations.
-
-|HashSet operation|LINQ equivalent|
-|-------------------------------|---------------------|
-|||
-|||
-|||
-|Not provided.||
-||Not provided.|
-||Not provided.|
-||Not provided.|
-||Not provided.|
-||Not provided.|
-||Not provided.|
-||Not provided.|
-
-
-
-## Examples
- The following example demonstrates how to merge two disparate sets. This example creates two objects, and populates them with even and odd numbers, respectively. A third object is created from the set that contains the even numbers. The example then calls the method, which adds the odd number set to the third set.
-
+ For more information about this API, see Supplemental API remarks for HashSet<T>.
+
+ objects and populates them with even and odd numbers, respectively. A third object is created from the set that contains the even numbers. The example then calls the method, which adds the odd number set to the third set.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs" interactive="try-dotnet-method" id="Snippet01":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet01":::
-
- ]]>
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet01":::
+ ]]>
+
@@ -239,21 +185,21 @@
Initializes a new instance of the class that is empty and uses the default equality comparer for the set type.
- object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
-
- This constructor is an O(1) operation.
-
-
-
-## Examples
- The following example demonstrates how to create and populate two objects. This example is part of a larger example provided for the method.
-
- :::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs" id="Snippet03":::
+ object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
+
+ This constructor is an O(1) operation.
+
+
+
+## Examples
+ The following example demonstrates how to create and populate two objects. This example is part of a larger example provided for the method.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs" id="Snippet03":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet03":::
-
+
]]>
@@ -296,23 +242,23 @@
The collection whose elements are copied to the new set.
Initializes a new instance of the class that uses the default equality comparer for the set type, contains elements copied from the specified collection, and has sufficient capacity to accommodate the number of elements copied.
- object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
-
- If `collection` contains duplicates, the set will contain one of each unique element. No exception will be thrown. Therefore, the size of the resulting set is not identical to the size of `collection`.
-
- This constructor is an O(`n`) operation, where `n` is the number of elements in the `collection` parameter.
-
-
-
-## Examples
- The following example shows how to create a collection from an existing set. In this example, two sets are created with even and odd integers, respectively. A third object is then created from the even integer set.
-
+ object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
+
+ If `collection` contains duplicates, the set will contain one of each unique element. No exception will be thrown. Therefore, the size of the resulting set is not identical to the size of `collection`.
+
+ This constructor is an O(`n`) operation, where `n` is the number of elements in the `collection` parameter.
+
+
+
+## Examples
+ The following example shows how to create a collection from an existing set. In this example, two sets are created with even and odd integers, respectively. A third object is then created from the even integer set.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs" interactive="try-dotnet-method" id="Snippet01":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -365,13 +311,13 @@
The implementation to use when comparing values in the set, or to use the default implementation for the set type.
Initializes a new instance of the class that is empty and uses the specified equality comparer for the set type.
- object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
-
- This constructor is an O(1) operation.
-
+ object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
+
+ This constructor is an O(1) operation.
+
]]>
@@ -409,11 +355,11 @@
The initial size of the .
Initializes a new instance of the class that is empty, but has reserved space for items and uses the default equality comparer for the set type.
-
@@ -466,24 +412,24 @@
The implementation to use when comparing values in the set, or to use the default implementation for the set type.
Initializes a new instance of the class that uses the specified equality comparer for the set type, contains elements copied from the specified collection, and has sufficient capacity to accommodate the number of elements copied.
- object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
-
- If `collection` contains duplicates, the set will contain one of each unique element. No exception will be thrown. Therefore, the size of the resulting set is not identical to the size of `collection`.
-
- This constructor is an O(`n`) operation, where `n` is the number of elements in the `collection` parameter.
-
-
-
-## Examples
- The following example uses a supplied to allow case-insensitive comparisons on the elements of a collection of vehicle types.
-
+ object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
+
+ If `collection` contains duplicates, the set will contain one of each unique element. No exception will be thrown. Therefore, the size of the resulting set is not identical to the size of `collection`.
+
+ This constructor is an O(`n`) operation, where `n` is the number of elements in the `collection` parameter.
+
+
+
+## Examples
+ The following example uses a supplied to allow case-insensitive comparisons on the elements of a collection of vehicle types.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp" id="Snippet03":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/.ctor/source2.cs" interactive="try-dotnet-method" id="Snippet03":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/vb/source2.vb" id="Snippet03":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/vb/source2.vb" id="Snippet03":::
+
]]>
@@ -533,11 +479,11 @@
The implementation to use when comparing values in the set, or null (Nothing in Visual Basic) to use the default implementation for the set type.
Initializes a new instance of the class that uses the specified equality comparer for the set type, and has sufficient capacity to accommodate elements.
-
@@ -594,11 +540,11 @@
A structure that contains the source and destination of the serialized stream associated with the object.
Initializes a new instance of the class with serialized data.
-
@@ -658,20 +604,20 @@
if the element is added to the object; if the element is already present.
- already equals the capacity of the object, the capacity is automatically adjusted to accommodate the new item.
-
- If is less than the capacity of the internal array, this method is an O(1) operation. If the object must be resized, this method becomes an O(`n`) operation, where `n` is .
-
-
-
-## Examples
- The following example demonstrates how to create and populate two objects. This example is part of a larger example provided for the method.
-
- :::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs" id="Snippet03":::
-
+ already equals the capacity of the object, the capacity is automatically adjusted to accommodate the new item.
+
+ If is less than the capacity of the internal array, this method is an O(1) operation. If the object must be resized, this method becomes an O(`n`) operation, where `n` is .
+
+
+
+## Examples
+ The following example demonstrates how to create and populate two objects. This example is part of a larger example provided for the method.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs" id="Snippet03":::
+
]]>
@@ -717,21 +663,21 @@
Removes all elements from a object.
- is set to zero and references to other objects from elements of the collection are also released. The capacity remains unchanged until a call to is made.
-
- This method is an O(`n`) operation, where `n` is .
-
-
-
-## Examples
- The following example creates and populates a collection, then clears it and releases the memory referenced by the collection.
-
+ is set to zero and references to other objects from elements of the collection are also released. The capacity remains unchanged until a call to is made.
+
+ This method is an O(`n`) operation, where `n` is .
+
+
+
+## Examples
+ The following example creates and populates a collection, then clears it and releases the memory referenced by the collection.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Clear/Program.cs" interactive="try-dotnet-method" id="Snippet01":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_Clear/vb/Program.vb" id="Snippet01":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_Clear/vb/Program.vb" id="Snippet01":::
+
]]>
@@ -780,11 +726,11 @@
Gets the object that is used to determine equality for the values in the set.
The object that is used to determine equality for the values in the set.
-
@@ -836,19 +782,19 @@
if the object contains the specified element; otherwise, .
- collection using the method. In this example, the method verifies that the set contains a value before removing it.
-
+ collection using the method. In this example, the method verifies that the set contains a value before removing it.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Contains/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_RemoveWhere/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_RemoveWhere/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -905,11 +851,11 @@
The one-dimensional array that is the destination of the elements copied from the object. The array must have zero-based indexing.
Copies the elements of a object to an array.
- .
-
+ .
+
]]>
@@ -962,11 +908,11 @@
The zero-based index in at which copying begins.
Copies the elements of a object to an array, starting at the specified array index.
- .
-
+ .
+
]]>
@@ -1022,26 +968,26 @@
The number of elements to copy to .
Copies the specified number of elements of a object to an array, starting at the specified array index.
-
is .
- is less than 0.
-
- -or-
-
+ is less than 0.
+
+ -or-
+
is less than 0.
- is greater than the length of the destination .
-
- -or-
-
+ is greater than the length of the destination .
+
+ -or-
+
is greater than the available space from the to the end of the destination .
@@ -1093,23 +1039,23 @@
Gets the number of elements that are contained in a set.
The number of elements that are contained in the set.
- object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
-
- The capacity is always greater than or equal to . If exceeds the capacity while adding elements, the capacity is set to the first prime number that is greater than double the previous capacity.
-
- Retrieving the value of this property is an O(1) operation.
-
-
-
-## Examples
- The following example demonstrates how to create, populate, and manipulate two objects. In this example, both the contents of the set and display to the console.
-
+ object is the number of elements that the object can hold. A object's capacity automatically increases as elements are added to the object.
+
+ The capacity is always greater than or equal to . If exceeds the capacity while adding elements, the capacity is set to the first prime number that is greater than double the previous capacity.
+
+ Retrieving the value of this property is an O(1) operation.
+
+
+
+## Examples
+ The following example demonstrates how to create, populate, and manipulate two objects. In this example, both the contents of the set and display to the console.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs" interactive="try-dotnet-method" id="Snippet01":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet01":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet01":::
+
]]>
@@ -1151,13 +1097,13 @@
Returns an object that can be used for equality testing of a object.
An object that can be used for deep equality testing of the object.
- object checks for equality at only one level; however, you can chain together comparers at additional levels to perform deeper equality testing.
-
- Calling this method is an O(1) operation.
-
+ object checks for equality at only one level; however, you can chain together comparers at additional levels to perform deeper equality testing.
+
+ Calling this method is an O(1) operation.
+
]]>
@@ -1248,22 +1194,22 @@
The collection of items to remove from the object.
Removes all elements in the specified collection from the current object.
- method is the equivalent of mathematical set subtraction.
-
- This method is an O(`n`) operation, where `n` is the number of elements in the `other` parameter.
-
-
-
-## Examples
- The following example creates two collections with overlapping sets of data. The lower range of values is then removed from the larger set using the method.
-
+ method is the equivalent of mathematical set subtraction.
+
+ This method is an O(`n`) operation, where `n` is the number of elements in the `other` parameter.
+
+
+
+## Examples
+ The following example creates two collections with overlapping sets of data. The lower range of values is then removed from the larger set using the method.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp" id="Snippet02":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/.ctor/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -1309,27 +1255,27 @@
Returns an enumerator that iterates through a object.
A object for the object.
- 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 object 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(1) operation.
-
+ 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 object 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(1) operation.
+
]]>
@@ -1392,11 +1338,11 @@
A structure that contains the source and destination of the serialized stream associated with the object.
Implements the interface and returns the data needed to serialize a object.
- .
-
+ .
+
]]>
@@ -1456,11 +1402,11 @@
The collection to compare to the current object.
Modifies the current object to contain only elements that are present in that object and in the specified collection.
- collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is and `m` is the number of elements in `other`.
-
+ collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is and `m` is the number of elements in `other`.
+
]]>
@@ -1523,23 +1469,23 @@
if the object is a proper subset of ; otherwise, .
- object is empty unless the `other` parameter is also an empty set.
-
- This method always returns `false` if is greater than or equal to the number of elements in `other`.
-
- If the collection represented by `other` is a collection with the same equality comparer as the current object, then this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is and `m` is the number of elements in `other`.
-
-
-
-## Examples
- The following example creates two disparate objects and compares them to each other. In this example, `lowNumbers` is both a subset and a proper subset of `allNumbers` until `allNumbers` is modified, using the method, to contain only values that are present in both sets. Once `allNumbers` and `lowNumbers` are identical, `lowNumbers` is still a subset of `allNumbers` but is no longer a proper subset.
-
+ object is empty unless the `other` parameter is also an empty set.
+
+ This method always returns `false` if is greater than or equal to the number of elements in `other`.
+
+ If the collection represented by `other` is a collection with the same equality comparer as the current object, then this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is and `m` is the number of elements in `other`.
+
+
+
+## Examples
+ The following example creates two disparate objects and compares them to each other. In this example, `lowNumbers` is both a subset and a proper subset of `allNumbers` until `allNumbers` is modified, using the method, to contain only values that are present in both sets. Once `allNumbers` and `lowNumbers` are identical, `lowNumbers` is still a subset of `allNumbers` but is no longer a proper subset.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/IsProperSubsetOf/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -1602,23 +1548,23 @@
if the object is a proper superset of ; otherwise, .
- collection is also empty.
-
- This method always returns `false` if is less than or equal to the number of elements in `other`.
-
- If the collection represented by `other` is a collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is the number of elements in `other` and `m` is .
-
-
-
-## Examples
- The following example creates two disparate objects and compares them to each other. In this example, `allNumbers` is both a superset and a proper superset of `lowNumbers` until `allNumbers` is modified, using the method, to contain only values that are present in both sets. Once `allNumbers` and `lowNumbers` are identical, `allNumbers` is still a superset of `lowNumbers` but is no longer a proper superset.
-
+ collection is also empty.
+
+ This method always returns `false` if is less than or equal to the number of elements in `other`.
+
+ If the collection represented by `other` is a collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is the number of elements in `other` and `m` is .
+
+
+
+## Examples
+ The following example creates two disparate objects and compares them to each other. In this example, `allNumbers` is both a superset and a proper superset of `lowNumbers` until `allNumbers` is modified, using the method, to contain only values that are present in both sets. Once `allNumbers` and `lowNumbers` are identical, `allNumbers` is still a superset of `lowNumbers` but is no longer a proper superset.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/IsProperSubsetOf/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -1681,23 +1627,23 @@
if the object is a subset of ; otherwise, .
- object is empty, even if the `other` parameter is an empty set.
-
- This method always returns `false` if is greater than the number of elements in `other`.
-
- If the collection represented by `other` is a collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is and `m` is the number of elements in `other`.
-
-
-
-## Examples
- The following example creates two disparate objects and compares them to each other. In this example, `lowNumbers` is both a subset and a proper subset of `allNumbers` until `allNumbers` is modified, using the method, to contain only values that are present in both sets. Once `allNumbers` and `lowNumbers` are identical, `lowNumbers` is still a subset of `allNumbers` but is no longer a proper subset.
-
+ object is empty, even if the `other` parameter is an empty set.
+
+ This method always returns `false` if is greater than the number of elements in `other`.
+
+ If the collection represented by `other` is a collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is and `m` is the number of elements in `other`.
+
+
+
+## Examples
+ The following example creates two disparate objects and compares them to each other. In this example, `lowNumbers` is both a subset and a proper subset of `allNumbers` until `allNumbers` is modified, using the method, to contain only values that are present in both sets. Once `allNumbers` and `lowNumbers` are identical, `lowNumbers` is still a subset of `allNumbers` but is no longer a proper subset.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/IsProperSubsetOf/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -1754,23 +1700,23 @@
if the object is a superset of ; otherwise, .
- object is empty.
-
- This method always returns `false` if is less than the number of elements in `other`.
-
- If the collection represented by `other` is a collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is the number of elements in `other` and `m` is .
-
-
-
-## Examples
- The following example creates two disparate objects and compares them to each other. In this example, `allNumbers` is both a superset and a proper superset of `lowNumbers` until `allNumbers` is modified, using the method, to contain only values that are present in both sets. Once `allNumbers` and `lowNumbers` are identical, `allNumbers` is still a superset of `lowNumbers` but is no longer a proper superset.
-
+ object is empty.
+
+ This method always returns `false` if is less than the number of elements in `other`.
+
+ If the collection represented by `other` is a collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is the number of elements in `other` and `m` is .
+
+
+
+## Examples
+ The following example creates two disparate objects and compares them to each other. In this example, `allNumbers` is both a superset and a proper superset of `lowNumbers` until `allNumbers` is modified, using the method, to contain only values that are present in both sets. Once `allNumbers` and `lowNumbers` are identical, `allNumbers` is still a superset of `lowNumbers` but is no longer a proper superset.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/IsProperSubsetOf/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -1826,11 +1772,11 @@
The source of the deserialization event.
Implements the interface and raises the deserialization event when the deserialization is complete.
- .
-
+ .
+
]]>
The object associated with the current object is invalid.
@@ -1886,19 +1832,19 @@
if the object and share at least one common element; otherwise, .
- objects and compares them to each another. In this example, `allNumbers` and `lowNumbers` are shown to share common elements using the method.
-
+ objects and compares them to each another. In this example, `allNumbers` and `lowNumbers` are shown to share common elements using the method.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/IsProperSubsetOf/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -1951,21 +1897,21 @@
if the element is successfully found and removed; otherwise, . This method returns if is not found in the object.
- object does not contain the specified element, the object remains unchanged. No exception is thrown.
-
- This method is an O(1) operation.
-
-
-
-## Examples
- The following example demonstrates how to remove values from a collection using the method. In this example, zero is arbitrarily removed from the collection.
-
+ object does not contain the specified element, the object remains unchanged. No exception is thrown.
+
+ This method is an O(1) operation.
+
+
+
+## Examples
+ The following example demonstrates how to remove values from a collection using the method. In this example, zero is arbitrarily removed from the collection.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Contains/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_RemoveWhere/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_RemoveWhere/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -2012,19 +1958,19 @@
Removes all elements that match the conditions defined by the specified predicate from a collection.
The number of elements that were removed from the collection.
- .
-
-
-
-## Examples
- The following example demonstrates how to remove values from a collection using the method. In this example, all odd integers are removed from the collection as specified by the `match` delegate.
-
+ .
+
+
+
+## Examples
+ The following example demonstrates how to remove values from a collection using the method. In this example, all odd integers are removed from the collection as specified by the `match` delegate.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Contains/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_RemoveWhere/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_RemoveWhere/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -2087,21 +2033,21 @@
if the object is equal to ; otherwise, .
- method ignores duplicate entries and the order of elements in the `other` parameter.
-
- If the collection represented by `other` is a collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is the number of elements in `other` and `m` is .
-
-
-
-## Examples
- The following example creates two disparate objects and compares them to each another. Initially, the two sets are not equal, which is demonstrated by using the method. The `allNumbers` object is then modified, after which the sets are equal.
-
+ method ignores duplicate entries and the order of elements in the `other` parameter.
+
+ If the collection represented by `other` is a collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is the number of elements in `other` and `m` is .
+
+
+
+## Examples
+ The following example creates two disparate objects and compares them to each another. Initially, the two sets are not equal, which is demonstrated by using the method. The `allNumbers` object is then modified, after which the sets are equal.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/IsProperSubsetOf/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_boolMethods/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -2161,19 +2107,19 @@
The collection to compare to the current object.
Modifies the current object to contain only elements that are present either in that object or in the specified collection, but not both.
- collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is the number of elements in `other` and `m` is .
-
-
-
-## Examples
- The following example creates two collections with overlapping sets of data. The set that contains the lower values is then modified, using the method, to contain only the values that are not present in both sets.
-
+ collection with the same equality comparer as the current object, this method is an O(`n`) operation. Otherwise, this method is an O(`n` + `m`) operation, where `n` is the number of elements in `other` and `m` is .
+
+
+
+## Examples
+ The following example creates two collections with overlapping sets of data. The set that contains the lower values is then modified, using the method, to contain only the values that are not present in both sets.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/SymmetricExceptWith/Program.cs" interactive="try-dotnet-method" id="Snippet02":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_SymmetricExceptWith/vb/Program.vb" id="Snippet02":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_SymmetricExceptWith/vb/Program.vb" id="Snippet02":::
+
]]>
@@ -2224,11 +2170,11 @@
The object to add to the object.
Adds an item to an object.
- is less than , this method is an O(1) operation. If the capacity must be increased to accommodate the new element, this method becomes an O(`n`) operation, where `n` is .
-
+ is less than , this method is an O(1) operation. If the capacity must be increased to accommodate the new element, this method becomes an O(`n`) operation, where `n` is .
+
]]>
The is read-only.
@@ -2276,11 +2222,11 @@
if the collection is read-only; otherwise, .
-
@@ -2327,27 +2273,27 @@
Returns an enumerator that iterates through a collection.
An object 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 object 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 its behavior is undefined.
-
- 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(1) operation.
-
+ 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 object 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 its behavior is undefined.
+
+ 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(1) operation.
+
]]>
@@ -2395,27 +2341,27 @@
Returns an enumerator that iterates through a collection.
An object 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 its behavior is undefined.
-
- 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(1) operation.
-
+ 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 its behavior is undefined.
+
+ 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(1) operation.
+
]]>
@@ -2459,21 +2405,21 @@
Sets the capacity of a object to the actual number of elements it contains, rounded up to a nearby, implementation-specific value.
- method to minimize a object's memory overhead once it is known that no new elements will be added. To completely clear a object and release all memory referenced by it, call this method after calling the method.
-
- This method is an O(`n`) operation, where `n` is .
-
-
-
-## Examples
- The following example creates and populates a collection, and then clears the collection and releases the memory referenced by it.
-
+ method to minimize a object's memory overhead once it is known that no new elements will be added. To completely clear a object and release all memory referenced by it, call this method after calling the method.
+
+ This method is an O(`n`) operation, where `n` is .
+
+
+
+## Examples
+ The following example creates and populates a collection, and then clears the collection and releases the memory referenced by it.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Clear/Program.cs" interactive="try-dotnet-method" id="Snippet01":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_Clear/vb/Program.vb" id="Snippet01":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_Clear/vb/Program.vb" id="Snippet01":::
+
]]>
@@ -2524,11 +2470,11 @@
Searches the set for a given value and returns the equal value it finds, if any.
A value indicating whether the search was successful.
-
@@ -2580,19 +2526,19 @@
The collection to compare to the current object.
Modifies the current object to contain all elements that are present in itself, the specified collection, or both.
- objects, and populates them with even and odd numbers, respectively. A third object is created from the set that contains the even numbers. The example then calls the method, which adds the odd number set to the third set.
-
+ objects, and populates them with even and odd numbers, respectively. A third object is created from the set that contains the even numbers. The example then calls the method, which adds the odd number set to the third set.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/HashSetT/Overview/Program.cs" interactive="try-dotnet-method" id="Snippet01":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet01":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_UnionWith/vb/Program.vb" id="Snippet01":::
+
]]>
diff --git a/xml/System.Collections.Generic/List`1.xml b/xml/System.Collections.Generic/List`1.xml
index 967dc784a70..fb54935e8b4 100644
--- a/xml/System.Collections.Generic/List`1.xml
+++ b/xml/System.Collections.Generic/List`1.xml
@@ -1,5300 +1,5238 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(2)]
- [<System.Runtime.CompilerServices.Nullable(2)>]
-
-
-
-
-
- System.Object
-
-
-
- System.Collections.Generic.ICollection<T>
-
-
- System.Collections.Generic.IEnumerable<T>
-
-
- System.Collections.Generic.IList<T>
-
-
- System.Collections.Generic.IReadOnlyCollection<T>
-
-
- System.Collections.Generic.IReadOnlyList<T>
-
-
- System.Collections.ICollection
-
-
- System.Collections.IEnumerable
-
-
- System.Collections.IList
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(0)]
- [<System.Runtime.CompilerServices.Nullable(0)>]
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
- [System.Diagnostics.DebuggerDisplay("Count = {Count}")]
- [<System.Diagnostics.DebuggerDisplay("Count = {Count}")>]
-
-
- [System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.Mscorlib_CollectionDebugView<>))]
- [<System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.Mscorlib_CollectionDebugView<>))>]
-
-
- [System.Serializable]
- [<System.Serializable>]
-
-
-
- The type of elements in the list.
- Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.
-
- class is the generic equivalent of the class. It implements the generic interface by using an array whose size is dynamically increased as required.
-
- You can add items to a by using the or methods.
-
- The class uses both an equality comparer and an ordering comparer.
-
-- Methods such as , , , and use an equality comparer for the list elements. The default equality comparer for type `T` is determined as follows. If type `T` implements the generic interface, then the equality comparer is the method of that interface; otherwise, the default equality comparer is .
-
-- Methods such as and use an ordering comparer for the list elements. The default comparer for type `T` is determined as follows. If type `T` implements the generic interface, then the default comparer is the method of that interface; otherwise, if type `T` implements the nongeneric interface, then the default comparer is the method of that interface. If type `T` implements neither interface, then there is no default comparer, and a comparer or comparison delegate must be provided explicitly.
-
- The is not guaranteed to be sorted. You must sort the before performing operations (such as ) that require the to be sorted.
-
- Elements in this collection can be accessed using an integer index. Indexes in this collection are zero-based.
-
- **.NET Framework only:** For very large objects, you can increase the maximum capacity to 2 billion elements on a 64-bit system by setting the `enabled` attribute of the [``](/dotnet/framework/configure-apps/file-schema/runtime/gcallowverylargeobjects-element) configuration element to `true` in the run-time environment.
-
- accepts `null` as a valid value for reference types and allows duplicate elements.
-
- For an immutable version of the class, see .
-
-## Performance Considerations
- In deciding whether to use the or class, both of which have similar functionality, remember that the class performs better in most cases and is type safe. If a reference type is used for type `T` of the class, the behavior of the two classes is identical. However, if a value type is used for type `T`, you need to consider implementation and boxing issues.
-
- If a value type is used for type `T`, the compiler generates an implementation of the class specifically for that value type. That means a list element of a object does not have to be boxed before the element can be used, and after about 500 list elements are created, the memory saved by not boxing list elements is greater than the memory used to generate the class implementation.
-
- Make certain the value type used for type `T` implements the generic interface. If not, methods such as must call the method, which boxes the affected list element. If the value type implements the interface and you own the source code, also implement the generic interface to prevent the and methods from boxing list elements. If you do not own the source code, pass an object to the and methods
-
- It is to your advantage to use the type-specific implementation of the class instead of using the class or writing a strongly typed wrapper collection yourself. That's because your implementation must do what the .NET Framework does for you already, and the common language runtime can share Microsoft intermediate language code and metadata, which your implementation cannot.
-
-## F# Considerations
- The class is used infrequently in F# code. Instead, [Lists](/dotnet/fsharp/language-reference/lists), which are immutable, singly-linked lists, are typically preferred. An F# `List` provides an ordered, immutable series of values, and is supported for use in functional-style development. When used from F#, the class is typically referred to by the `ResizeArray<'T>` type abbreviation to avoid naming conflicts with F# Lists.
-
-## Examples
-
- The following example demonstrates how to add, remove, and insert a simple business object in a .
-
- :::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/program.cs" interactive="try-dotnet" id="snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb" id="snippet1":::
- :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs" id="snippet1":::
-
- The following example demonstrates several properties and methods of the generic class of type string. (For an example of a of complex types, see the method.)
-
- The parameterless constructor is used to create a list of strings with the default capacity. The property is displayed and then the method is used to add several items. The items are listed, and the property is displayed again, along with the property, to show that the capacity has been increased as needed.
-
- The method is used to test for the presence of an item in the list, the method is used to insert a new item in the middle of the list, and the contents of the list are displayed again.
-
- The default property (the indexer in C#) is used to retrieve an item, the method is used to remove the first instance of the duplicate item added earlier, and the contents are displayed again. The method always removes the first instance it encounters.
-
- The method is used to reduce the capacity to match the count, and the and properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized.
-
- Finally, the method is used to remove all items from the list, and the and properties are displayed.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
- :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
- Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
-
- It is safe to perform multiple read operations on a , but issues can occur if the collection is modified while it's being read. To ensure thread safety, lock the collection during a read or write operation. To enable a collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization. For collections with built-in synchronization, see the classes in the namespace. For an inherently thread-safe alternative, see the class.
-
-
- Performing Culture-Insensitive String Operations in Collections
- Iterators (C#)
- Iterators (Visual Basic)
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
-
-
- Initializes a new instance of the class.
-
-
-
-
-
-
-
-
- Constructor
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
-
- 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, using the constructor and 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 method or by setting the property explicitly. Decreasing the capacity reallocates memory and copies all the elements in the .
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+
+
+
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(2)]
+ [<System.Runtime.CompilerServices.Nullable(2)>]
+
+
+
+
+
+ System.Object
+
+
+
+ System.Collections.Generic.ICollection<T>
+
+
+ System.Collections.Generic.IEnumerable<T>
+
+
+ System.Collections.Generic.IList<T>
+
+
+ System.Collections.Generic.IReadOnlyCollection<T>
+
+
+ System.Collections.Generic.IReadOnlyList<T>
+
+
+ System.Collections.ICollection
+
+
+ System.Collections.IEnumerable
+
+
+ System.Collections.IList
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(0)]
+ [<System.Runtime.CompilerServices.Nullable(0)>]
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+ [System.Diagnostics.DebuggerDisplay("Count = {Count}")]
+ [<System.Diagnostics.DebuggerDisplay("Count = {Count}")>]
+
+
+ [System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.Mscorlib_CollectionDebugView<>))]
+ [<System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.Mscorlib_CollectionDebugView<>))>]
+
+
+ [System.Serializable]
+ [<System.Serializable>]
+
+
+
+ The type of elements in the list.
+ Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.
+ For more information about this API, see Supplemental API remarks for List<T>.
+ Public static ( in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
+
+ It is safe to perform multiple read operations on a , but issues can occur if the collection is modified while it's being read. To ensure thread safety, lock the collection during a read or write operation. To enable a collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization. For collections with built-in synchronization, see the classes in the namespace. For an inherently thread-safe alternative, see the class.
+
+
+ Performing Culture-Insensitive String Operations in Collections
+ Iterators (C#)
+ Iterators (Visual Basic)
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+
+
+ Initializes a new instance of the class.
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+
+ 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, using the constructor and 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 method or by setting the property explicitly. Decreasing the capacity reallocates memory and copies all the elements in the .
+
This constructor is an O(1) operation.
-
-## Examples
- The following example demonstrates the parameterless constructor of the generic class. The parameterless constructor creates a list with the default capacity, as demonstrated by displaying the property.
-
- The example adds, inserts, and removes items, showing how the capacity changes as these methods are used.
-
+## Examples
+
+ The following example demonstrates the parameterless constructor of the generic class. The parameterless constructor creates a list with the default capacity, as demonstrated by displaying the property.
+
+ The example adds, inserts, and removes items, showing how the capacity changes as these methods are used.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
- Constructor
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
-
-
- The collection whose elements are copied to the new list.
- 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.
-
- in the same order they are read by the enumerator of the collection.
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+
+
+ The collection whose elements are copied to the new list.
+ 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.
+
+ in the same order they are read by the enumerator of the collection.
+
This constructor is an O(*n*) operation, where *n* is the number of elements in `collection`.
-
-## Examples
- The following example demonstrates the constructor and various methods of the class that act on ranges. An array of strings is created and passed to the constructor, populating the list with the elements of the array. The property is then displayed, to show that the initial capacity is exactly what is required to hold the input elements.
-
+
+## Examples
+ The following example demonstrates the constructor and various methods of the class that act on ranges. An array of strings is created and passed to the constructor, populating the list with the elements of the array. The property is then displayed, to show that the initial capacity is exactly what is required to hold the input elements.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
- Constructor
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
-
-
-
- The number of elements that the new list can initially store.
- Initializes a new instance of the class that is empty and has the specified 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 the method or by setting the property explicitly. Decreasing the capacity reallocates memory and copies all the elements in the .
-
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+
+
+
+ The number of elements that the new list can initially store.
+ Initializes a new instance of the class that is empty and has the specified 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 the method or by setting the property explicitly. Decreasing the capacity reallocates memory and copies all the elements in the .
+
This constructor is an O(1) operation.
-
-## Examples
- The following example demonstrates the constructor. A of strings with a capacity of 4 is created, because the ultimate size of the list is known to be exactly 4. The list is populated with four strings, and a read-only copy is created by using the method.
-
+
+## Examples
+ The following example demonstrates the constructor. A of strings with a capacity of 4 is created, because the ultimate size of the list is known to be exactly 4. The list is populated with four strings, and a read-only copy is created by using the method.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_AsReadOnly/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is less than 0.
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.Add(`0)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
- The object to be added to the end of the . The value can be for reference types.
- Adds an object to the end of the .
-
- accepts `null` as a valid value for reference types and allows duplicate elements.
-
- If already equals , 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.
-
+
+ ]]>
+
+
+ is less than 0.
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.ICollection`1.Add(`0)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+ The object to be added to the end of the . The value can be for reference types.
+ Adds an object to the end of the .
+
+ accepts `null` as a valid value for reference types and allows duplicate elements.
+
+ If already equals , 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 is less than , this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates how to add, remove, and insert a simple business object in a .
-
+## Examples
+
+ The following example demonstrates how to add, remove, and insert a simple business object in a .
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs" id="Snippet1":::
-
- The following example demonstrates several properties and methods of the generic class, including the method. The parameterless constructor is used to create a list of strings with a capacity of 0. The property is displayed, and then the method is used to add several items. The items are listed, and the property is displayed again, along with the property, to show that the capacity has been increased as needed.
-
- Other properties and methods are used to search for, insert, and remove elements from the list, and finally to clear the list.
-
+
+ The following example demonstrates several properties and methods of the generic class, including the method. The parameterless constructor is used to create a list of strings with a capacity of 0. The property is displayed, and then the method is used to add several items. The items are listed, and the property is displayed again, along with the property, to show that the capacity has been increased as needed.
+
+ Other properties and methods are used to search for, insert, and remove elements from the list, and finally to clear the list.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
- The collection whose elements should be added to the end of the . The collection itself cannot be , but it can contain elements that are , if type is a reference type.
- Adds the elements of the specified collection to the end of the .
-
- .
-
- If the new (the current plus the size of the collection) will be greater than , the capacity of the is increased by automatically reallocating the internal array to accommodate the new elements, and the existing elements are copied to the new array before the new elements are added.
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+ The collection whose elements should be added to the end of the . The collection itself cannot be , but it can contain elements that are , if type is a reference type.
+ Adds the elements of the specified collection to the end of the .
+
+ .
+
+ If the new (the current plus the size of the collection) will be greater than , the capacity of the is increased by automatically reallocating the internal array to accommodate the new elements, and the existing elements are copied to the new array before the new elements are added.
+
If the can accommodate the new elements without increasing the , this method is an O(*n*) operation, where *n* is the number of elements to be added. If the capacity needs to be increased to accommodate the new elements, this method becomes an O(*n* + *m*) operation, where *n* is the number of elements to be added and *m* is .
-
-## Examples
- The following example demonstrates the method and various other methods of the class that act on ranges. An array of strings is created and passed to the constructor, populating the list with the elements of the array. The method is called, with the list as its argument. The result is that the current elements of the list are added to the end of the list, duplicating all the elements.
-
+
+## Examples
+ The following example demonstrates the method and various other methods of the class that act on ranges. An array of strings is created and passed to the constructor, populating the list with the elements of the array. The method is called, with the list as its argument. The result is that the current elements of the list are added to the end of the list, duplicating all the elements.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Collections.ObjectModel.ReadOnlyCollection<T>
-
-
-
- Returns a read-only wrapper for the current collection.
- An object that acts as a read-only wrapper around the current .
-
- object, expose it only through this wrapper. A object does not expose methods that modify the collection. However, if changes are made to the underlying object, the read-only collection reflects those changes.
-
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Collections.ObjectModel.ReadOnlyCollection<T>
+
+
+
+ Returns a read-only wrapper for the current collection.
+ An object that acts as a read-only wrapper around the current .
+
+ object, expose it only through this wrapper. A object does not expose methods that modify the collection. However, if changes are made to the underlying object, the read-only collection reflects those changes.
+
This method is an O(1) operation.
-
-## Examples
- The following example demonstrates the method. A of strings with a capacity of 4 is created, because the ultimate size of the list is known to be exactly 4. The list is populated with four strings, and the method is used to get a read-only generic interface implementation that wraps the original list.
-
- An element of the original list is set to "Coelophysis" using the property (the indexer in C#), and the contents of the read-only list are displayed again to demonstrate that it is just a wrapper for the original list.
-
+
+## Examples
+ The following example demonstrates the method. A of strings with a capacity of 4 is created, because the ultimate size of the list is known to be exactly 4. The list is populated with four strings, and the method is used to get a read-only generic interface implementation that wraps the original list.
+
+ An element of the original list is set to "Coelophysis" using the property (the indexer in C#), and the contents of the read-only list are displayed again to demonstrate that it is just a wrapper for the original list.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_AsReadOnly/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
-
-
- Uses a binary search algorithm to locate a specific element in the sorted or a portion of it.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
- The object to locate. The value can be for reference types.
- Searches the entire sorted for an element using the default comparer and returns the zero-based index of the element.
- The zero-based index of in the sorted , if is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .
-
- for type `T` to determine the order of list elements. The property checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws an .
-
- The must already be sorted according to the comparer implementation; otherwise, the result is incorrect.
-
- Comparing `null` with any reference type is allowed and does not generate an exception when using the generic interface. When sorting, `null` is considered to be less than any other object.
-
- If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.
-
- If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.
-
+
+ ]]>
+
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+
+
+ Uses a binary search algorithm to locate a specific element in the sorted or a portion of it.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+ The object to locate. The value can be for reference types.
+ Searches the entire sorted for an element using the default comparer and returns the zero-based index of the element.
+ The zero-based index of in the sorted , if is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .
+
+ for type `T` to determine the order of list elements. The property checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws an .
+
+ The must already be sorted according to the comparer implementation; otherwise, the result is incorrect.
+
+ Comparing `null` with any reference type is allowed and does not generate an exception when using the generic interface. When sorting, `null` is considered to be less than any other object.
+
+ If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.
+
+ If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.
+
This method is an O(log *n*) operation, where *n* is the number of elements in the range.
-
-## Examples
- The following example demonstrates the method overload and the method overload. A of strings is created and populated with four strings, in no particular order. The list is displayed, sorted, and displayed again.
-
- The method overload is then used to search for two strings that are not in the list, and the method is used to insert them. The return value of the method is negative in each case, because the strings are not in the list. Taking the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of this negative number produces the index of the first element in the list that is larger than the search string, and inserting at this location preserves the sort order. The second search string is larger than any element in the list, so the insertion position is at the end of the list.
-
+
+## Examples
+ The following example demonstrates the method overload and the method overload. A of strings is created and populated with four strings, in no particular order. The list is displayed, sorted, and displayed again.
+
+ The method overload is then used to search for two strings that are not in the list, and the method is used to insert them. The return value of the method is negative in each case, because the strings are not in the list. Taking the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of this negative number produces the index of the first element in the list that is larger than the search string, and inserting at this location preserves the sort order. The second search string is larger than any element in the list, so the insertion position is at the end of the list.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearch/vb/source.vb" id="Snippet1":::
-
- ]]>
-
- The default comparer cannot find an implementation of the generic interface or the interface for type .
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
-
-
-
-
-
- The object to locate. The value can be for reference types.
- The implementation to use when comparing elements.
-
- -or-
-
- to use the default comparer .
- Searches the entire sorted for an element using the specified comparer and returns the zero-based index of the element.
- The zero-based index of in the sorted , if is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .
-
- instance as the comparer to perform case-insensitive string searches.
-
- If `comparer` is provided, the elements of the are compared to the specified value using the specified implementation.
-
- If `comparer` is `null`, the default comparer checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws .
-
- The must already be sorted according to the comparer implementation; otherwise, the result is incorrect.
-
- Comparing `null` with any reference type is allowed and does not generate an exception when using the generic interface. When sorting, `null` is considered to be less than any other object.
-
- If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.
-
- If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.
-
+
+ ]]>
+
+ The default comparer cannot find an implementation of the generic interface or the interface for type .
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
+
+
+
+
+
+ The object to locate. The value can be for reference types.
+ The implementation to use when comparing elements.
+
+ -or-
+
+ to use the default comparer .
+ Searches the entire sorted for an element using the specified comparer and returns the zero-based index of the element.
+ The zero-based index of in the sorted , if is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .
+
+ instance as the comparer to perform case-insensitive string searches.
+
+ If `comparer` is provided, the elements of the are compared to the specified value using the specified implementation.
+
+ If `comparer` is `null`, the default comparer checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws .
+
+ The must already be sorted according to the comparer implementation; otherwise, the result is incorrect.
+
+ Comparing `null` with any reference type is allowed and does not generate an exception when using the generic interface. When sorting, `null` is considered to be less than any other object.
+
+ If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.
+
+ If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.
+
This method is an O(log *n*) operation, where *n* is the number of elements in the range.
-
-## Examples
- The following example demonstrates the method overload and the method overload.
-
- The example defines an alternative comparer for strings named DinoCompare, which implements the `IComparer` (`IComparer(Of String)` in Visual Basic, `IComparer` in Visual C++) generic interface. The comparer works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
-
- A of strings is created and populated with four strings, in no particular order. The list is displayed, sorted using the alternate comparer, and displayed again.
-
- The method overload is then used to search for several strings that are not in the list, employing the alternate comparer. The method is used to insert the strings. These two methods are located in the function named `SearchAndInsert`, along with code to take the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of the negative number returned by and use it as an index for inserting the new string.
-
+
+## Examples
+ The following example demonstrates the method overload and the method overload.
+
+ The example defines an alternative comparer for strings named DinoCompare, which implements the `IComparer` (`IComparer(Of String)` in Visual Basic, `IComparer` in Visual C++) generic interface. The comparer works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
+
+ A of strings is created and populated with four strings, in no particular order. The list is displayed, sorted using the alternate comparer, and displayed again.
+
+ The method overload is then used to search for several strings that are not in the list, employing the alternate comparer. The method is used to insert the strings. These two methods are located in the function named `SearchAndInsert`, along with code to take the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of the negative number returned by and use it as an index for inserting the new string.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearchComparer/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is , and the default comparer cannot find an implementation of the generic interface or the interface for type .
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
-
-
-
-
-
- The zero-based starting index of the range to search.
- The length of the range to search.
- The object to locate. The value can be for reference types.
- The implementation to use when comparing elements, or to use the default comparer .
- Searches a range of elements in the sorted for an element using the specified comparer and returns the zero-based index of the element.
- The zero-based index of in the sorted , if is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .
-
- instance as the comparer to perform case-insensitive string searches.
-
- If `comparer` is provided, the elements of the are compared to the specified value using the specified implementation.
-
- If `comparer` is `null`, the default comparer checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws .
-
- The must already be sorted according to the comparer implementation; otherwise, the result is incorrect.
-
- Comparing `null` with any reference type is allowed and does not generate an exception when using the generic interface. When sorting, `null` is considered to be less than any other object.
-
- If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.
-
- If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.
-
+
+ ]]>
+
+
+ is , and the default comparer cannot find an implementation of the generic interface or the interface for type .
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
+
+
+
+
+
+ The zero-based starting index of the range to search.
+ The length of the range to search.
+ The object to locate. The value can be for reference types.
+ The implementation to use when comparing elements, or to use the default comparer .
+ Searches a range of elements in the sorted for an element using the specified comparer and returns the zero-based index of the element.
+ The zero-based index of in the sorted , if is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .
+
+ instance as the comparer to perform case-insensitive string searches.
+
+ If `comparer` is provided, the elements of the are compared to the specified value using the specified implementation.
+
+ If `comparer` is `null`, the default comparer checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws .
+
+ The must already be sorted according to the comparer implementation; otherwise, the result is incorrect.
+
+ Comparing `null` with any reference type is allowed and does not generate an exception when using the generic interface. When sorting, `null` is considered to be less than any other object.
+
+ If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.
+
+ If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.
+
This method is an O(log *n*) operation, where *n* is the number of elements in the range.
-
-## Examples
- The following example demonstrates the method overload and the method overload.
-
- The example defines an alternative comparer for strings named DinoCompare, which implements the `IComparer` (`IComparer(Of String)` in Visual Basic, `IComparer` in Visual C++) generic interface. The comparer works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
-
- A of strings is created and populated with the names of five herbivorous dinosaurs and three carnivorous dinosaurs. Within each of the two groups, the names are not in any particular sort order. The list is displayed, the range of herbivores is sorted using the alternate comparer, and the list is displayed again.
-
- The method overload is then used to search only the range of herbivores for "Brachiosaurus". The string is not found, and the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of the negative number returned by the method is used as an index for inserting the new string.
-
+
+## Examples
+ The following example demonstrates the method overload and the method overload.
+
+ The example defines an alternative comparer for strings named DinoCompare, which implements the `IComparer` (`IComparer(Of String)` in Visual Basic, `IComparer` in Visual C++) generic interface. The comparer works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
+
+ A of strings is created and populated with the names of five herbivorous dinosaurs and three carnivorous dinosaurs. Within each of the two groups, the names are not in any particular sort order. The list is displayed, the range of herbivores is sorted using the alternate comparer, and the list is displayed again.
+
+ The method overload is then used to search only the range of herbivores for "Brachiosaurus". The string is not found, and the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of the negative number returned by the method is used as an index for inserting the new string.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source2.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearchComparerRange/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is less than 0.
-
- -or-
-
- is less than 0.
-
- and do not denote a valid range in the .
-
- is , and the default comparer cannot find an implementation of the generic interface or the interface for type .
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Property
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Int32
-
-
- Gets or sets the total number of elements the internal data structure can hold without resizing.
- The number of elements that the can contain before resizing is required.
-
- is the number of elements that the can store before resizing is required, whereas is the number of elements that are actually in the .
-
- is always greater than or equal to . If exceeds while adding elements, the capacity is increased by automatically reallocating the internal array before copying the old elements and adding the new elements.
-
- If the capacity is significantly larger than the count and you want to reduce the memory used by the , you can decrease capacity by calling the method or by setting the property explicitly to a lower value. When the value of is set explicitly, the internal array is also reallocated to accommodate the specified capacity, and all the elements are copied.
-
+
+ ]]>
+
+
+ is less than 0.
+
+ -or-
+
+ is less than 0.
+
+ and do not denote a valid range in the .
+
+ is , and the default comparer cannot find an implementation of the generic interface or the interface for type .
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Property
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Int32
+
+
+ Gets or sets the total number of elements the internal data structure can hold without resizing.
+ The number of elements that the can contain before resizing is required.
+
+ is the number of elements that the can store before resizing is required, whereas is the number of elements that are actually in the .
+
+ is always greater than or equal to . If exceeds while adding elements, the capacity is increased by automatically reallocating the internal array before copying the old elements and adding the new elements.
+
+ If the capacity is significantly larger than the count and you want to reduce the memory used by the , you can decrease capacity by calling the method or by setting the property explicitly to a lower value. When the value of is set explicitly, the internal array is also reallocated to accommodate the specified capacity, and all the elements are copied.
+
Retrieving the value of this property is an O(1) operation; setting the property is an O(*n*) operation, where *n* is the new capacity.
-
-## Examples
-
- The following example demonstrates how to check the capacity and count of a that contains a simple business object, and illustrates using the method to remove extra capacity.
-
+
+## Examples
+
+ The following example demonstrates how to check the capacity and count of a that contains a simple business object, and illustrates using the method to remove extra capacity.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Capacity/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.capacitycount/vb/module1.vb" id="Snippet1":::
-
- The following example shows the property at several points in the life of a list. The parameterless constructor is used to create a list of strings with a capacity of 0, and the property is displayed to demonstrate this. After the method has been used to add several items, the items are listed, and then the property is displayed again, along with the property, to show that the capacity has been increased as needed.
-
- The property is displayed again after the method is used to reduce the capacity to match the count. Finally, the method is used to remove all items from the list, and the and properties are displayed again.
-
+
+ The following example shows the property at several points in the life of a list. The parameterless constructor is used to create a list of strings with a capacity of 0, and the property is displayed to demonstrate this. After the method has been used to add several items, the items are listed, and then the property is displayed again, along with the property, to show that the capacity has been increased as needed.
+
+ The property is displayed again after the method is used to reduce the capacity to match the count. Finally, the method is used to remove all items from the list, and the and properties are displayed again.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
-
- is set to a value that is less than .
- There is not enough memory available on the system.
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.Clear
- M:System.Collections.IList.Clear
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
- Removes all elements from the .
-
- is set to 0, and references to other objects from elements of the collection are also released.
-
- remains unchanged. To reset the capacity of the , call the method or set the property directly. Decreasing the capacity reallocates memory and copies all the elements in the . Trimming an empty sets the capacity of the to the default capacity.
-
+
+ ]]>
+
+
+ is set to a value that is less than .
+ There is not enough memory available on the system.
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.ICollection`1.Clear
+ M:System.Collections.IList.Clear
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+ Removes all elements from the .
+
+ is set to 0, and references to other objects from elements of the collection are also released.
+
+ remains unchanged. To reset the capacity of the , call the method or set the property directly. Decreasing the capacity reallocates memory and copies all the elements in the . 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 example demonstrates the method and various other properties and methods of the generic class. The method is used at the end of the program, to remove all items from the list, and the and properties are then displayed.
-
+## Examples
+
+ The following example demonstrates the method and various other properties and methods of the generic class. The method is used at the end of the program, to remove all items from the list, and the and properties are then displayed.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.Contains(`0)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Boolean
-
-
-
-
-
- The object to locate in the . The value can be for reference types.
- Determines whether an element is in the .
-
- if is found in the ; otherwise, .
-
- method for `T` (the type of values in the list).
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.ICollection`1.Contains(`0)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Boolean
+
+
+
+
+
+ The object to locate in the . The value can be for reference types.
+ Determines whether an element is in the .
+
+ if is found in the ; otherwise, .
+
+ method 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 example demonstrates the and methods on a that contains a simple business object that implements .
-
+
+## Examples
+ The following example demonstrates the and methods on a that contains a simple business object that implements .
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Contains/program1.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/vb/module1.vb" id="Snippet1":::
-
- The following example contains a list of complex objects of type `Cube`. The `Cube` class implements the method so that two cubes are considered equal if their dimensions are the same. In this example, the method returns `true`, because a cube that has the specified dimensions is already in the collection.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/vb/module1.vb" id="Snippet1":::
+
+ The following example contains a list of complex objects of type `Cube`. The `Cube` class implements the method so that two cubes are considered equal if their dimensions are the same. In this example, the method returns `true`, because a cube that has the specified dimensions is already in the collection.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Contains/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.contains/vb/program.vb" id="Snippet1":::
-
- ]]>
-
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Collections
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- System.Collections.Generic.List<TOutput>
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(2)]
- [<System.Runtime.CompilerServices.Nullable(2)>]
-
-
-
-
-
-
-
-
- The type of the elements of the target array.
- A delegate that converts each element from one type to another type.
- Converts the elements in the current to another type, and returns a list containing the converted elements.
- A of the target type containing the converted elements from the current .
-
- is a delegate to a method that converts an object to the target type. The elements of the current are individually passed to the delegate, and the converted elements are saved in the new .
-
- The current remains unchanged.
-
+
+ ]]>
+
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Collections
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ System.Collections.Generic.List<TOutput>
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(2)]
+ [<System.Runtime.CompilerServices.Nullable(2)>]
+
+
+
+
+
+
+
+
+ The type of the elements of the target array.
+ A delegate that converts each element from one type to another type.
+ Converts the elements in the current to another type, and returns a list containing the converted elements.
+ A of the target type containing the converted elements from the current .
+
+ is a delegate to a method that converts an object to the target type. The elements of the current are individually passed to the delegate, and the converted elements are saved in the new .
+
+ The current remains unchanged.
+
This method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example defines a method named `PointFToPoint` that converts a structure to a structure. The example then creates a of structures, creates a `Converter\` delegate (`Converter(Of PointF, Point)` in Visual Basic) to represent the `PointFToPoint` method, and passes the delegate to the method. The method passes each element of the input list to the `PointFToPoint` method and puts the converted elements into a new list of structures. Both lists are displayed.
-
+
+## Examples
+ The following example defines a method named `PointFToPoint` that converts a structure to a structure. The example then creates a of structures, creates a `Converter\` delegate (`Converter(Of PointF, Point)` in Visual Basic) to represent the `PointFToPoint` method, and passes the delegate to the method. The method passes each element of the input list to the `PointFToPoint` method and puts the converted elements into a new list of structures. Both lists are displayed.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/ConverterTInput,TOutput/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_ConvertAll/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
-
-
- Copies the or a portion of it to an array.
-
- method. A of strings is created and populated with 5 strings. An empty string array of 15 elements is created, and the method overload is used to copy all the elements of the list to the array beginning at the first element of the array. The method overload is used to copy all the elements of the list to the array beginning at array index 6 (leaving index 5 empty). Finally, the method overload is used to copy 3 elements from the list, beginning with index 2, to the array beginning at array index 12 (leaving index 11 empty). The contents of the array are then displayed.
-
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+
+
+ Copies the or a portion of it to an array.
+
+ method. A of strings is created and populated with 5 strings. An empty string array of 15 elements is created, and the method overload is used to copy all the elements of the list to the array beginning at the first element of the array. The method overload is used to copy all the elements of the list to the array beginning at array index 6 (leaving index 5 empty). Finally, the method overload is used to copy 3 elements from the list, beginning with index 2, to the array beginning at array index 12 (leaving index 11 empty). The contents of the array are then displayed.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/CopyTo/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_CopyTo/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Void
-
-
-
-
-
- The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
- Copies the entire to a compatible one-dimensional array, starting at the beginning of the target array.
-
- to copy the elements.
-
- The elements are copied to the in the same order in which the enumerator iterates through the .
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Void
+
+
+
+
+
+ The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
+ Copies the entire to a compatible one-dimensional array, starting at the beginning of the target array.
+
+ to copy the elements.
+
+ The elements are copied to the in the same order in which the enumerator iterates through the .
+
+ This method is an O(*n*) operation, where *n* is .
+
+ ]]>
+
+
+ is .
+ The number of elements in the source is greater than the number of elements that the destination can contain.
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
+ The zero-based index in at which copying begins.
+ Copies the entire to a compatible one-dimensional array, starting at the specified index of the target array.
+
+ to copy the elements.
+
+ The elements are copied to the in the same order in which the enumerator iterates through the .
+
This method is an O(*n*) operation, where *n* is .
-
- ]]>
-
-
- is .
- The number of elements in the source is greater than the number of elements that the destination can contain.
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
- The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
- The zero-based index in at which copying begins.
- Copies the entire to a compatible one-dimensional array, starting at the specified index of the target array.
-
- to copy the elements.
-
- The elements are copied to the in the same order in which the enumerator iterates through the .
-
- This method is an O(*n*) operation, where *n* is .
-
- ]]>
-
-
- is .
-
- is less than 0.
- The number of elements in the source is greater than the available space from to the end of the destination .
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
-
-
- The zero-based index in the source at which copying begins.
- The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
- The zero-based index in at which copying begins.
- The number of elements to copy.
- Copies a range of elements from the to a compatible one-dimensional array, starting at the specified index of the target array.
-
- to copy the elements.
-
- The elements are copied to the in the same order in which the enumerator iterates through the .
-
- This method is an O(*n*) operation, where *n* is `count`.
-
- ]]>
-
-
- is .
-
- is less than 0.
-
- -or-
-
- is less than 0.
-
- -or-
-
- is less than 0.
-
- is equal to or greater than the of the source .
-
- -or-
-
- The number of elements from to the end of the source is greater than the available space from to the end of the destination .
-
-
-
-
-
-
-
-
-
- Property
-
- P:System.Collections.Generic.ICollection`1.Count
- P:System.Collections.Generic.IReadOnlyCollection`1.Count
- P:System.Collections.ICollection.Count
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
- Gets the number of elements contained in the .
- The number of elements contained in the .
-
- is the number of elements that the can store before resizing is required. is the number of elements that are actually in the .
-
- is always greater than or equal to . If exceeds while adding elements, the capacity is increased by automatically reallocating the internal array before copying the old elements and adding the new elements.
-
+
+ ]]>
+
+
+ is .
+
+ is less than 0.
+ The number of elements in the source is greater than the available space from to the end of the destination .
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ The zero-based index in the source at which copying begins.
+ The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
+ The zero-based index in at which copying begins.
+ The number of elements to copy.
+ Copies a range of elements from the to a compatible one-dimensional array, starting at the specified index of the target array.
+
+ to copy the elements.
+
+ The elements are copied to the in the same order in which the enumerator iterates through the .
+
+ This method is an O(*n*) operation, where *n* is `count`.
+
+ ]]>
+
+
+ is .
+
+ is less than 0.
+
+ -or-
+
+ is less than 0.
+
+ -or-
+
+ is less than 0.
+
+ is equal to or greater than the of the source .
+
+ -or-
+
+ The number of elements from to the end of the source is greater than the available space from to the end of the destination .
+
+
+
+
+
+
+
+
+
+ Property
+
+ P:System.Collections.Generic.ICollection`1.Count
+ P:System.Collections.Generic.IReadOnlyCollection`1.Count
+ P:System.Collections.ICollection.Count
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+ Gets the number of elements contained in the .
+ The number of elements contained in the .
+
+ is the number of elements that the can store before resizing is required. is the number of elements that are actually in the .
+
+ is always greater than or equal to . If exceeds 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 example demonstrates how to check the capacity and count of a that contains a simple business object, and illustrates using the method to remove extra capacity.
-
+## Examples
+
+ The following example demonstrates how to check the capacity and count of a that contains a simple business object, and illustrates using the method to remove extra capacity.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Capacity/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.capacitycount/vb/module1.vb" id="Snippet1":::
-
- The following example shows the value of the property at various points in the life of a list. After the list has been created and populated and its elements displayed, the and properties are displayed. These properties are displayed again after the method has been called, and again after the contents of the list are cleared.
+
+ The following example shows the value of the property at various points in the life of a list. After the list has been created and populated and its elements displayed, the and properties are displayed. These properties are displayed again after the method has been called, and again after the contents of the list are cleared.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
-
-
- netstandard
-
-
- System.Int32
-
-
-
-
-
- The minimum capacity to ensure.
- Ensures that the capacity of this list is at least the specified . If the current capacity is less than , it is increased to at least the specified .
- The new capacity of this list.
- To be added.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Boolean
-
-
-
-
-
- The delegate that defines the conditions of the elements to search for.
- Determines whether the contains elements that match the conditions defined by the specified predicate.
-
- if the contains one or more elements that match the conditions defined by the specified predicate; otherwise, .
-
- is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, and processing is stopped when a match is found.
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+
+
+ netstandard
+
+
+ System.Int32
+
+
+
+
+
+ The minimum capacity to ensure.
+ Ensures that the capacity of this list is at least the specified . If the current capacity is less than , it is increased to at least the specified .
+ The new capacity of this list.
+ To be added.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Boolean
+
+
+
+
+
+ The delegate that defines the conditions of the elements to search for.
+ Determines whether the contains elements that match the conditions defined by the specified predicate.
+
+ if the contains one or more elements that match the conditions defined by the specified predicate; otherwise, .
+
+ is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, and processing is stopped when a match is found.
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the and methods on a that contains a simple business object that implements .
-
+
+## Examples
+ The following example demonstrates the and methods on a that contains a simple business object that implements .
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Contains/program1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/vb/module1.vb" id="Snippet1":::
-
- The following example demonstrates the method and several other methods that use the generic delegate.
-
- A of strings is created, containing 8 dinosaur names, two of which (at positions 1 and 5) end with "saurus". The example also defines a search predicate method named `EndsWithSaurus`, which accepts a string parameter and returns a Boolean value indicating whether the input string ends in "saurus".
-
- The , , and methods are used to search the list with the search predicate method, and then the method is used to remove all entries ending with "saurus".
-
- Finally, the method is called. It traverses the list from the beginning, passing each element in turn to the `EndsWithSaurus` method. The search stops and the method returns `true` if the `EndsWithSaurus` method returns `true` for any element. The method returns `false` because all such elements have been removed.
-
+
+ The following example demonstrates the method and several other methods that use the generic delegate.
+
+ A of strings is created, containing 8 dinosaur names, two of which (at positions 1 and 5) end with "saurus". The example also defines a search predicate method named `EndsWithSaurus`, which accepts a string parameter and returns a Boolean value indicating whether the input string ends in "saurus".
+
+ The , , and methods are used to search the list with the search predicate method, and then the method is used to remove all entries ending with "saurus".
+
+ Finally, the method is called. It traverses the list from the beginning, passing each element in turn to the `EndsWithSaurus` method. The search stops and the method returns `true` if the `EndsWithSaurus` method returns `true` for any element. The method returns `false` because all such elements have been removed.
+
> [!NOTE]
-> In C# and Visual Basic, it is not necessary to create the `Predicate` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context and create it automatically.
-
+> In C# and Visual Basic, it is not necessary to create the `Predicate` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context and create it automatically.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Exists/source.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- T
-
-
-
-
-
- The delegate that defines the conditions of the element to search for.
- Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire .
- The first element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type .
-
- is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, moving forward in the , starting with the first element and ending with the last element. Processing is stopped when a match is found.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ T
+
+
+
+
+
+ The delegate that defines the conditions of the element to search for.
+ Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire .
+ The first element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type .
+
+ is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, moving forward in the , starting with the first element and ending with the last element. Processing is stopped when a match is found.
+
> [!IMPORTANT]
-> When searching a list containing value types, make sure the default value for the type does not satisfy the search predicate. Otherwise, there is no way to distinguish between a default value indicating that no match was found and a list element that happens to have the default value for the type. If the default value satisfies the search predicate, use the method instead.
-
+> When searching a list containing value types, make sure the default value for the type does not satisfy the search predicate. Otherwise, there is no way to distinguish between a default value indicating that no match was found and a list element that happens to have the default value for the type. If the default value satisfies the search predicate, use the method instead.
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the method on a that contains a simple complex object.
-
+
+## Examples
+ The following example demonstrates the method on a that contains a simple complex object.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Contains/program1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/vb/module1.vb" id="Snippet1":::
-
- The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
-
- The following table describes the examples provided for the find methods.
-
-|Method|Example|
-|------------|-------------|
-||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
-||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
-||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
-||Finds the index of first computer book using the `FindComputer` predicate delegate.|
-||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
-||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-
+
+ The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
+
+ The following table describes the examples provided for the find methods.
+
+|Method|Example|
+|------------|-------------|
+||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
+||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
+||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
+||Finds the index of first computer book using the `FindComputer` predicate delegate.|
+||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
+||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Find/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Collections.Generic.List<T>
-
-
-
-
-
- The delegate that defines the conditions of the elements to search for.
- Retrieves all the elements that match the conditions defined by the specified predicate.
- A containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty .
-
- is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, and the elements that match the conditions are saved in the returned .
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Collections.Generic.List<T>
+
+
+
+
+
+ The delegate that defines the conditions of the elements to search for.
+ Retrieves all the elements that match the conditions defined by the specified predicate.
+ A containing all the elements that match the conditions defined by the specified predicate, if found; otherwise, an empty .
+
+ is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, and the elements that match the conditions are saved in the returned .
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
-
- The following table describes the examples provided for the find methods.
-
-|Method|Example|
-|------------|-------------|
-||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
-||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
-||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
-||Finds the index of first computer book using the `FindComputer` predicate delegate.|
-||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
-||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-
+
+## Examples
+ The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
+
+ The following table describes the examples provided for the find methods.
+
+|Method|Example|
+|------------|-------------|
+||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
+||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
+||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
+||Finds the index of first computer book using the `FindComputer` predicate delegate.|
+||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
+||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Find/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
-
-
- Searches for an element that matches the conditions defined by a specified predicate, and returns the zero-based index of the first occurrence within the or a portion of it. This method returns -1 if an item that matches the conditions is not found.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
- The delegate that defines the conditions of the element to search for.
- Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire .
- The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
-
- is searched forward starting at the first element and ending at the last element.
-
- The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate. The delegate has the signature:
-
-```csharp
-public bool methodName(T obj)
-```
-
-```vb
-Public Function methodName(obj As T) As Boolean
-```
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+
+
+ Searches for an element that matches the conditions defined by a specified predicate, and returns the zero-based index of the first occurrence within the or a portion of it. This method returns -1 if an item that matches the conditions is not found.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+ The delegate that defines the conditions of the element to search for.
+ Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire .
+ The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
+
+ is searched forward starting at the first element and ending at the last element.
+
+ The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate. The delegate has the signature:
+
+```csharp
+public bool methodName(T obj)
+```
+
+```vb
+Public Function methodName(obj As T) As Boolean
+```
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example defines an `Employee` class with two fields, `Name` and `Id`. It also defines an `EmployeeSearch` class with a single method, `StartsWith`, that indicates whether the `Employee.Name` field starts with a specified substring that is supplied to the `EmployeeSearch` class constructor. Note the signature of this method
-
-```csharp
-public bool StartsWith(Employee e)
-```
-
-```vb
-Public Function StartsWith(e As Employee) As Boolean
-```
-
- corresponds to the signature of the delegate that can be passed to the method. The example instantiates a `List` object, adds a number of `Employee` objects to it, and then calls the method twice to search the entire collection, the first time for the first `Employee` object whose `Name` field begins with "J", and the second time for the first `Employee` object whose `Name` field begins with "Ju".
-
+
+## Examples
+ The following example defines an `Employee` class with two fields, `Name` and `Id`. It also defines an `EmployeeSearch` class with a single method, `StartsWith`, that indicates whether the `Employee.Name` field starts with a specified substring that is supplied to the `EmployeeSearch` class constructor. Note the signature of this method
+
+```csharp
+public bool StartsWith(Employee e)
+```
+
+```vb
+Public Function StartsWith(e As Employee) As Boolean
+```
+
+ corresponds to the signature of the delegate that can be passed to the method. The example instantiates a `List` object, adds a number of `Employee` objects to it, and then calls the method twice to search the entire collection, the first time for the first `Employee` object whose `Name` field begins with "J", and the second time for the first `Employee` object whose `Name` field begins with "Ju".
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/FindIndex/FindIndex2.cs" interactive="try-dotnet" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex2.vb" id="Snippet2":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
- The zero-based starting index of the search.
- The delegate that defines the conditions of the element to search for.
- Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the that extends from the specified index to the last element.
- The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
-
- is searched forward starting at `startIndex` and ending at the last element.
-
- The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate. The delegate has the signature:
-
-```csharp
-public bool methodName(T obj)
-```
-
-```vb
-Public Function methodName(obj As T) As Boolean
-```
-
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+ The zero-based starting index of the search.
+ The delegate that defines the conditions of the element to search for.
+ Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the that extends from the specified index to the last element.
+ The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
+
+ is searched forward starting at `startIndex` and ending at the last element.
+
+ The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate. The delegate has the signature:
+
+```csharp
+public bool methodName(T obj)
+```
+
+```vb
+Public Function methodName(obj As T) As Boolean
+```
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is the number of elements from `startIndex` to the end of the .
-
-## Examples
- The following example defines an `Employee` class with two fields, `Name` and `Id`. It also defines an `EmployeeSearch` class with a single method, `StartsWith`, that indicates whether the `Employee.Name` field starts with a specified substring that is supplied to the `EmployeeSearch` class constructor. Note the signature of this method
-
-```csharp
-public bool StartsWith(Employee e)
-```
-
-```vb
-Public Function StartsWith(e As Employee) As Boolean
-```
-
- corresponds to the signature of the delegate that can be passed to the method. The example instantiates a `List` object, adds a number of `Employee` objects to it, and then calls the method twice to search the collection starting with its fifth member (that is, the member at index 4). The first time, it searches for the first `Employee` object whose `Name` field begins with "J"; the second time, it searches for the first `Employee` object whose `Name` field begins with "Ju".
-
+
+## Examples
+ The following example defines an `Employee` class with two fields, `Name` and `Id`. It also defines an `EmployeeSearch` class with a single method, `StartsWith`, that indicates whether the `Employee.Name` field starts with a specified substring that is supplied to the `EmployeeSearch` class constructor. Note the signature of this method
+
+```csharp
+public bool StartsWith(Employee e)
+```
+
+```vb
+Public Function StartsWith(e As Employee) As Boolean
+```
+
+ corresponds to the signature of the delegate that can be passed to the method. The example instantiates a `List` object, adds a number of `Employee` objects to it, and then calls the method twice to search the collection starting with its fifth member (that is, the member at index 4). The first time, it searches for the first `Employee` object whose `Name` field begins with "J"; the second time, it searches for the first `Employee` object whose `Name` field begins with "Ju".
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/FindIndex/FindIndex3.cs" interactive="try-dotnet" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex3.vb" id="Snippet3":::
-
- ]]>
-
-
- is .
-
- is outside the range of valid indexes for the .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
-
- The zero-based starting index of the search.
- The number of elements in the section to search.
- The delegate that defines the conditions of the element to search for.
- Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the that starts at the specified index and contains the specified number of elements.
- The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
-
- is searched forward starting at `startIndex` and ending at `startIndex` plus `count` minus 1, if `count` is greater than 0.
-
- The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate. The delegate has the signature:
-
-```csharp
-public bool methodName(T obj)
-```
-
-```vb
-Public Function methodName(obj As T) As Boolean
-```
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex3.vb" id="Snippet3":::
+
+ ]]>
+
+
+ is .
+
+ is outside the range of valid indexes for the .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+
+ The zero-based starting index of the search.
+ The number of elements in the section to search.
+ The delegate that defines the conditions of the element to search for.
+ Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the that starts at the specified index and contains the specified number of elements.
+ The zero-based index of the first occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
+
+ is searched forward starting at `startIndex` and ending at `startIndex` plus `count` minus 1, if `count` is greater than 0.
+
+ The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate. The delegate has the signature:
+
+```csharp
+public bool methodName(T obj)
+```
+
+```vb
+Public Function methodName(obj As T) As Boolean
+```
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is `count`.
-
-## Examples
- The following example defines an `Employee` class with two fields, `Name` and `Id`. It also defines an `EmployeeSearch` class with a single method, `StartsWith`, that indicates whether the `Employee.Name` field starts with a specified substring that is supplied to the `EmployeeSearch` class constructor. Note the signature of this method
-
-```csharp
-public bool StartsWith(Employee e)
-```
-
-```vb
-Public Function StartsWith(e As Employee) As Boolean
-```
-
- corresponds to the signature of the delegate that can be passed to the method. The example instantiates a `List` object, adds a number of `Employee` objects to it, and then calls the method twice to search the entire collection (that is, the members from index 0 to index - 1). The first time, it searches for the first `Employee` object whose `Name` field begins with "J"; the second time, it searches for the first `Employee` object whose `Name` field begins with "Ju".
-
+
+## Examples
+ The following example defines an `Employee` class with two fields, `Name` and `Id`. It also defines an `EmployeeSearch` class with a single method, `StartsWith`, that indicates whether the `Employee.Name` field starts with a specified substring that is supplied to the `EmployeeSearch` class constructor. Note the signature of this method
+
+```csharp
+public bool StartsWith(Employee e)
+```
+
+```vb
+Public Function StartsWith(e As Employee) As Boolean
+```
+
+ corresponds to the signature of the delegate that can be passed to the method. The example instantiates a `List` object, adds a number of `Employee` objects to it, and then calls the method twice to search the entire collection (that is, the members from index 0 to index - 1). The first time, it searches for the first `Employee` object whose `Name` field begins with "J"; the second time, it searches for the first `Employee` object whose `Name` field begins with "Ju".
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/FindIndex/FindIndex1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.Collections.Generic.List.FindIndex/vb/FindIndex1.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
- is outside the range of valid indexes for the .
-
- -or-
-
- is less than 0.
-
- -or-
-
- and do not specify a valid section in the .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- T
-
-
-
-
-
- The delegate that defines the conditions of the element to search for.
- Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire .
- The last element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type .
-
- is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, moving backward in the , starting with the last element and ending with the first element. Processing is stopped when a match is found.
-
+
+ ]]>
+
+
+ is .
+
+ is outside the range of valid indexes for the .
+
+ -or-
+
+ is less than 0.
+
+ -or-
+
+ and do not specify a valid section in the .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ T
+
+
+
+
+
+ The delegate that defines the conditions of the element to search for.
+ Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire .
+ The last element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type .
+
+ is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, moving backward in the , starting with the last element and ending with the first element. Processing is stopped when a match is found.
+
> [!IMPORTANT]
-> When searching a list containing value types, make sure the default value for the type does not satisfy the search predicate. Otherwise, there is no way to distinguish between a default value indicating that no match was found and a list element that happens to have the default value for the type. If the default value satisfies the search predicate, use the method instead.
-
+> When searching a list containing value types, make sure the default value for the type does not satisfy the search predicate. Otherwise, there is no way to distinguish between a default value indicating that no match was found and a list element that happens to have the default value for the type. If the default value satisfies the search predicate, use the method instead.
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
-
- The following table describes the examples provided for the find methods.
-
-|Method|Example|
-|------------|-------------|
-||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
-||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
-||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
-||Finds the index of first computer book using the `FindComputer` predicate delegate.|
-||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
-||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-
+
+## Examples
+ The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
+
+ The following table describes the examples provided for the find methods.
+
+|Method|Example|
+|------------|-------------|
+||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
+||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
+||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
+||Finds the index of first computer book using the `FindComputer` predicate delegate.|
+||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
+||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Find/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
-
-
- Searches for an element that matches the conditions defined by a specified predicate, and returns the zero-based index of the last occurrence within the or a portion of it.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
- The delegate that defines the conditions of the element to search for.
- Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire .
- The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
-
- is searched backward starting at the last element and ending at the first element.
-
- The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+
+
+ Searches for an element that matches the conditions defined by a specified predicate, and returns the zero-based index of the last occurrence within the or a portion of it.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+ The delegate that defines the conditions of the element to search for.
+ Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire .
+ The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
+
+ is searched backward starting at the last element and ending at the first element.
+
+ The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate.
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
-
- The following table describes the examples provided for the find methods.
-
-|Method|Example|
-|------------|-------------|
-||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
-||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
-||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
-||Finds the index of first computer book using the `FindComputer` predicate delegate.|
-||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
-||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-
+
+## Examples
+ The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
+
+ The following table describes the examples provided for the find methods.
+
+|Method|Example|
+|------------|-------------|
+||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
+||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
+||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
+||Finds the index of first computer book using the `FindComputer` predicate delegate.|
+||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
+||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Find/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
- The zero-based starting index of the backward search.
- The delegate that defines the conditions of the element to search for.
- Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the that extends from the first element to the specified index.
- The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
-
- is searched backward starting at `startIndex` and ending at the first element.
-
- The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate.
-
- This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is the number of elements from the beginning of the to `startIndex`.
-
- ]]>
-
-
- is .
-
- is outside the range of valid indexes for the .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
-
- The zero-based starting index of the backward search.
- The number of elements in the section to search.
- The delegate that defines the conditions of the element to search for.
- Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the that contains the specified number of elements and ends at the specified index.
- The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
-
- is searched backward starting at `startIndex` and ending at `startIndex` minus `count` plus 1, if `count` is greater than 0.
-
- The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+ The zero-based starting index of the backward search.
+ The delegate that defines the conditions of the element to search for.
+ Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the that extends from the first element to the specified index.
+ The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
+
+ is searched backward starting at `startIndex` and ending at the first element.
+
+ The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate.
+
+ This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is the number of elements from the beginning of the to `startIndex`.
+
+ ]]>
+
+
+ is .
+
+ is outside the range of valid indexes for the .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+
+ The zero-based starting index of the backward search.
+ The number of elements in the section to search.
+ The delegate that defines the conditions of the element to search for.
+ Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the that contains the specified number of elements and ends at the specified index.
+ The zero-based index of the last occurrence of an element that matches the conditions defined by , if found; otherwise, -1.
+
+ is searched backward starting at `startIndex` and ending at `startIndex` minus `count` plus 1, if `count` is greater than 0.
+
+ The is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate.
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is `count`.
-
-## Examples
- The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
-
- The following table describes the examples provided for the find methods.
-
-|Method|Example|
-|------------|-------------|
-||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
-||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
-||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
-||Finds the index of first computer book using the `FindComputer` predicate delegate.|
-||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
-||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
-
+
+## Examples
+ The following example demonstrates the find methods for the class. The example for the class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](/dotnet/standard/linq/sample-xml-file-books). The `FillList` method in the example uses [LINQ to XML](/dotnet/standard/linq/linq-xml-overview) to parse the values from the XML to property values of the `book` objects.
+
+ The following table describes the examples provided for the find methods.
+
+|Method|Example|
+|------------|-------------|
+||Finds a book by an ID using the `IDToFind` predicate delegate.
C# example uses an anonymous delegate.|
+||Find all books that whose `Genre` property is "Computer" using the `FindComputer` predicate delegate.|
+||Finds the last book in the collection that has a publish date before 2001, using the `PubBefore2001` predicate delegate.
C# example uses an anonymous delegate.|
+||Finds the index of first computer book using the `FindComputer` predicate delegate.|
+||Finds the index of the last computer book using the `FindComputer` predicate delegate.|
+||Finds the index of first computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+||Finds the index of last computer book in the second half of the collection, using the `FindComputer` predicate delegate.|
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Find/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
- is outside the range of valid indexes for the .
-
- -or-
-
- is less than 0.
-
- -or-
-
- and do not specify a valid section in the .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
- The delegate to perform on each element of the .
- Performs the specified action on each element of the .
-
- is a delegate to a method that performs an action on the object passed to it. The elements of the current are individually passed to the delegate.
-
- This method is an O(*n*) operation, where *n* is .
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/list`1_find_methods/vb/module1.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is .
+
+ is outside the range of valid indexes for the .
+
+ -or-
+
+ is less than 0.
+
+ -or-
+
+ and do not specify a valid section in the .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+ The delegate to perform on each element of the .
+ Performs the specified action on each element of the .
+
+ is a delegate to a method that performs an action on the object passed to it. The elements of the current are individually passed to the delegate.
+
+ This method is an O(*n*) operation, where *n* is .
+
Modifying the underlying collection in the body of the delegate is not supported and causes undefined behavior.
-
-## Examples
- The following example demonstrates the use of the delegate to print the contents of a object. In this example the `Print` method is used to display the contents of the list to the console.
-
+
+## Examples
+ The following example demonstrates the use of the delegate to print the contents of a object. In this example the `Print` method is used to display the contents of the list to the console.
+
> [!NOTE]
-> In addition to displaying the contents using the `Print` method, the C# example demonstrates the use of [anonymous methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods) to display the results to the console.
-
+> In addition to displaying the contents using the `Print` method, the C# example demonstrates the use of [anonymous methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods) to display the results to the console.
+
:::code language="csharp" source="~/snippets/csharp/System/ActionT/Overview/action.cs" interactive="try-dotnet-method" id="Snippet01":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Action_PrintExample/vb/action.vb" id="Snippet01":::
-
- ]]>
-
-
- is .
- An element in the collection has been modified.
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Collections.Generic.List<T>+Enumerator
-
-
-
- Returns an enumerator that iterates through the .
- A for 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 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(1) operation.
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Collections.Generic.List<T>
-
-
-
-
-
-
- The zero-based index at which the range starts.
- The number of elements in the range.
- Creates a shallow copy of a range of elements in the source .
- A shallow copy of a range of elements in the source .
-
-
+
+
+ is .
+ An element in the collection has been modified.
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Collections.Generic.List<T>+Enumerator
+
+
+
+ Returns an enumerator that iterates through the .
+ A for 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 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(1) operation.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Collections.Generic.List<T>
+
+
+
+
+
+
+ The zero-based index at which the range starts.
+ The number of elements in the range.
+ Creates a shallow copy of a range of elements in the source .
+ A shallow copy of a range of elements in the source .
+
+ method and other methods of the class that act on ranges. At the end of the example, the method is used to get three items from the list, beginning with index location 2. The method is called on the resulting , creating an array of three elements. The elements of the array are displayed.
-
+
+## Examples
+ The following example demonstrates the method and other methods of the class that act on ranges. At the end of the example, the method is used to get three items from the list, beginning with index location 2. The method is called on the resulting , creating an array of three elements. The elements of the array are displayed.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is less than 0.
-
- -or-
-
- is less than 0.
-
- and do not denote a valid range of elements in the .
-
-
-
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
-
-
- Returns the zero-based index of the first occurrence of a value in the or in a portion of it.
-
- method. A of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the list from the beginning, and finds the first occurrence of the string. The method overload is used to search the list beginning with index location 3 and continuing to the end of the list, and finds the second occurrence of the string. Finally, the method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is less than 0.
+
+ -or-
+
+ is less than 0.
+
+ and do not denote a valid range of elements in the .
+
+
+
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+
+
+ Returns the zero-based index of the first occurrence of a value in the or in a portion of it.
+
+ method. A of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the list from the beginning, and finds the first occurrence of the string. The method overload is used to search the list beginning with index location 3 and continuing to the end of the list, and finds the second occurrence of the string. Finally, the method overload is used to search a range of two entries, beginning at index location two; it returns -1 because there are no instances of the search string in that range.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/IndexOf/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_IndexOf/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.IList`1.IndexOf(`0)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Int32
-
-
-
-
-
- The object to locate in the . The value can be for reference types.
- Searches for the specified object and returns the zero-based index of the first occurrence within the entire .
- The zero-based index of the first occurrence of within the entire , if found; otherwise, -1.
-
- is searched forward starting at the first element and ending at the last element.
-
- This method determines equality using the default equality comparer 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 .
-
- ]]>
-
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
- The object to locate in the . The value can be for reference types.
- The zero-based starting index of the search. 0 (zero) is valid in an empty list.
- Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the that extends from the specified index to the last element.
- The zero-based index of the first occurrence of within the range of elements in the that extends from to the last element, if found; otherwise, -1.
-
- is searched forward starting at `index` and ending at the last element.
-
- This method determines equality using the default equality comparer 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 the number of elements from `index` to the end of the .
-
- ]]>
-
-
- is outside the range of valid indexes for the .
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
-
- The object to locate in the . The value can be for reference types.
- The zero-based starting index of the search. 0 (zero) is valid in an empty list.
- The number of elements in the section to search.
- Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the that starts at the specified index and contains the specified number of elements.
- The zero-based index of the first occurrence of within the range of elements in the that starts at and contains number of elements, if found; otherwise, -1.
-
- is searched forward starting at `index` and ending at `index` plus `count` minus 1, if `count` is greater than 0.
-
- This method determines equality using the default equality comparer 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 `count`.
-
- ]]>
-
-
- is outside the range of valid indexes for the .
-
- -or-
-
- is less than 0.
-
- -or-
-
- and do not specify a valid section in the .
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.IList`1.Insert(System.Int32,`0)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
- The zero-based index at which should be inserted.
- The object to insert. The value can be for reference types.
- Inserts an element into the at the specified index.
-
- accepts `null` as a valid value for reference types and allows duplicate elements.
-
- If already equals , 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 `index` is equal to , `item` is added to the end of .
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.IList`1.IndexOf(`0)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Int32
+
+
+
+
+
+ The object to locate in the . The value can be for reference types.
+ Searches for the specified object and returns the zero-based index of the first occurrence within the entire .
+ The zero-based index of the first occurrence of within the entire , if found; otherwise, -1.
+
+ is searched forward starting at the first element and ending at the last element.
+
+ This method determines equality using the default equality comparer 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 .
+
+ ]]>
+
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+ The object to locate in the . The value can be for reference types.
+ The zero-based starting index of the search. 0 (zero) is valid in an empty list.
+ Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the that extends from the specified index to the last element.
+ The zero-based index of the first occurrence of within the range of elements in the that extends from to the last element, if found; otherwise, -1.
+
+ is searched forward starting at `index` and ending at the last element.
+
+ This method determines equality using the default equality comparer 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 the number of elements from `index` to the end of the .
+
+ ]]>
+
+
+ is outside the range of valid indexes for the .
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+
+ The object to locate in the . The value can be for reference types.
+ The zero-based starting index of the search. 0 (zero) is valid in an empty list.
+ The number of elements in the section to search.
+ Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the that starts at the specified index and contains the specified number of elements.
+ The zero-based index of the first occurrence of within the range of elements in the that starts at and contains number of elements, if found; otherwise, -1.
+
+ is searched forward starting at `index` and ending at `index` plus `count` minus 1, if `count` is greater than 0.
+
+ This method determines equality using the default equality comparer 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 `count`.
+
+ ]]>
+
+
+ is outside the range of valid indexes for the .
+
+ -or-
+
+ is less than 0.
+
+ -or-
+
+ and do not specify a valid section in the .
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.IList`1.Insert(System.Int32,`0)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ The zero-based index at which should be inserted.
+ The object to insert. The value can be for reference types.
+ Inserts an element into the at the specified index.
+
+ accepts `null` as a valid value for reference types and allows duplicate elements.
+
+ If already equals , 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 `index` is equal to , `item` is added to the end of .
+
This method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates how to add, remove, and insert a simple business object in a .
-
+## Examples
+
+ The following example demonstrates how to add, remove, and insert a simple business object in a .
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs" id="Snippet1":::
-
- The following example demonstrates the method, along with various other properties and methods of the generic class. After the list is created, elements are added. The method is used to insert an item into the middle of the list. The item inserted is a duplicate, which is later removed using the method.
-
+
+ The following example demonstrates the method, along with various other properties and methods of the generic class. After the list is created, elements are added. The method is used to insert an item into the middle of the list. The item inserted is a duplicate, which is later removed using the method.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
-
- is less than 0.
-
- -or-
-
- is greater than .
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
- The zero-based index at which the new elements should be inserted.
- The collection whose elements should be inserted into the . The collection itself cannot be , but it can contain elements that are , if type is a reference type.
- Inserts the elements of a collection into the at the specified index.
-
- accepts `null` as a valid value for reference types and allows duplicate elements.
-
- If the new (the current plus the size of the collection) will be greater than , the capacity of the is increased by automatically reallocating the internal array to accommodate the new elements, and the existing elements are copied to the new array before the new elements are added.
-
- If `index` is equal to , the elements are added to the end of .
-
- The order of the elements in the collection is preserved in the .
-
+
+ ]]>
+
+
+ is less than 0.
+
+ -or-
+
+ is greater than .
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ The zero-based index at which the new elements should be inserted.
+ The collection whose elements should be inserted into the . The collection itself cannot be , but it can contain elements that are , if type is a reference type.
+ Inserts the elements of a collection into the at the specified index.
+
+ accepts `null` as a valid value for reference types and allows duplicate elements.
+
+ If the new (the current plus the size of the collection) will be greater than , the capacity of the is increased by automatically reallocating the internal array to accommodate the new elements, and the existing elements are copied to the new array before the new elements are added.
+
+ If `index` is equal to , the elements are added to the end of .
+
+ The order of the elements in the collection is preserved in the .
+
This method is an O(*n* * *m*) operation, where *n* is the number of elements to be added and *m* is .
-
-## Examples
- The following example demonstrates method and various other methods of the class that act on ranges. After the list has been created and populated with the names of several peaceful plant-eating dinosaurs, the method is used to insert an array of three ferocious meat-eating dinosaurs into the list, beginning at index location 3.
-
+
+## Examples
+ The following example demonstrates method and various other methods of the class that act on ranges. After the list has been created and populated with the names of several peaceful plant-eating dinosaurs, the method is used to insert an array of three ferocious meat-eating dinosaurs into the list, beginning at index location 3.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
- is less than 0.
-
- -or-
-
- is greater than .
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
-
- P:System.Collections.Generic.IList`1.Item(System.Int32)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
- [set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- T
-
-
-
-
-
- The zero-based index of the element to get or set.
- Gets or sets the element at the specified index.
- The element at the specified index.
-
- accepts `null` as a valid value for reference types and allows duplicate elements.
-
- This property provides the ability to access a specific element in the collection by using the following syntax: `myCollection[index]`.
-
+
+ ]]>
+
+
+ is .
+
+ is less than 0.
+
+ -or-
+
+ is greater than .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ P:System.Collections.Generic.IList`1.Item(System.Int32)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+ [set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ T
+
+
+
+
+
+ The zero-based index of the element to get or set.
+ Gets or sets the element at the specified index.
+ The element at the specified index.
+
+ accepts `null` as a valid value for reference types and allows duplicate elements.
+
+ This property provides the ability to access a specific element in the collection by using the following syntax: `myCollection[index]`.
+
Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.
-
-## Examples
- The example in this section demonstrates the property (the indexer in C#) and various other properties and methods of the generic class. After the list has been created and populated using the method, an element is retrieved and displayed using the property. (For an example that uses the property to set the value of a list element, see .)
-
+
+## Examples
+ The example in this section demonstrates the property (the indexer in C#) and various other properties and methods of the generic class. After the list has been created and populated using the method, an element is retrieved and displayed using the property. (For an example that uses the property to set the value of a list element, see .)
+
> [!NOTE]
-> Visual Basic, C#, and C++ all have syntax for accessing the property without using its name. Instead, the variable containing the is used as if it were an array.
-
- The C# language uses the [`this`](/dotnet/csharp/language-reference/keywords/this) keyword to define the indexers instead of implementing the property. Visual Basic implements as a default property, which provides the same indexing functionality.
-
+> Visual Basic, C#, and C++ all have syntax for accessing the property without using its name. Instead, the variable containing the is used as if it were an array.
+
+ The C# language uses the [`this`](/dotnet/csharp/language-reference/keywords/this) keyword to define the indexers instead of implementing the property. Visual Basic implements as a default property, which provides the same indexing functionality.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet3":::
-
- ]]>
-
-
- is less than 0.
-
- -or-
-
- is equal to or greater than .
-
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
-
-
- Returns the zero-based index of the last occurrence of a value in the or in a portion of it.
-
- method. A of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the entire list from the end, and finds the second occurrence of the string. The method overload is used to search the list backward beginning with index location 3 and continuing to the beginning of the list, so it finds the first occurrence of the string in the list. Finally, the method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet3":::
+
+ ]]>
+
+
+ is less than 0.
+
+ -or-
+
+ is equal to or greater than .
+
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+
+
+ Returns the zero-based index of the last occurrence of a value in the or in a portion of it.
+
+ method. A of strings is created, with one entry that appears twice, at index location 0 and index location 5. The method overload searches the entire list from the end, and finds the second occurrence of the string. The method overload is used to search the list backward beginning with index location 3 and continuing to the beginning of the list, so it finds the first occurrence of the string in the list. Finally, the method overload is used to search a range of four entries, beginning at index location 4 and extending backward (that is, it searches the items at locations 4, 3, 2, and 1); this search returns -1 because there are no instances of the search string in that range.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/LastIndexOf/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_LastIndexOf/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
- The object to locate in the . The value can be for reference types.
- Searches for the specified object and returns the zero-based index of the last occurrence within the entire .
- The zero-based index of the last occurrence of within the entire the , if found; otherwise, -1.
-
- is searched backward starting at the last element and ending at the first element.
-
- This method determines equality using the default equality comparer 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 .
-
- ]]>
-
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
- The object to locate in the . The value can be for reference types.
- The zero-based starting index of the backward search.
- Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the that extends from the first element to the specified index.
- The zero-based index of the last occurrence of within the range of elements in the that extends from the first element to , if found; otherwise, -1.
-
- is searched backward starting at `index` and ending at the first element.
-
- This method determines equality using the default equality comparer 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 the number of elements from the beginning of the to `index`.
-
- ]]>
-
-
- is outside the range of valid indexes for the .
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
-
-
- The object to locate in the . The value can be for reference types.
- The zero-based starting index of the backward search.
- The number of elements in the section to search.
- Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the that contains the specified number of elements and ends at the specified index.
- The zero-based index of the last occurrence of within the range of elements in the that contains number of elements and ends at , if found; otherwise, -1.
-
- is searched backward starting at `index` and ending at `index` minus `count` plus 1, if `count` is greater than 0.
-
- This method determines equality using the default equality comparer 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 `count`.
-
- ]]>
-
-
- is outside the range of valid indexes for the .
-
- -or-
-
- is less than 0.
-
- -or-
-
- and do not specify a valid section in the .
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.Remove(`0)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Boolean
-
-
-
-
-
- The object to remove from the . The value can be for reference types.
- Removes the first occurrence of a specific object from the .
-
- if is successfully removed; otherwise, . This method also returns if was not found in the .
-
- generic interface, the equality comparer is the method of that interface; otherwise, the default equality comparer is .
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+ The object to locate in the . The value can be for reference types.
+ Searches for the specified object and returns the zero-based index of the last occurrence within the entire .
+ The zero-based index of the last occurrence of within the entire the , if found; otherwise, -1.
+
+ is searched backward starting at the last element and ending at the first element.
+
+ This method determines equality using the default equality comparer 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 .
+
+ ]]>
+
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+ The object to locate in the . The value can be for reference types.
+ The zero-based starting index of the backward search.
+ Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the that extends from the first element to the specified index.
+ The zero-based index of the last occurrence of within the range of elements in the that extends from the first element to , if found; otherwise, -1.
+
+ is searched backward starting at `index` and ending at the first element.
+
+ This method determines equality using the default equality comparer 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 the number of elements from the beginning of the to `index`.
+
+ ]]>
+
+
+ is outside the range of valid indexes for the .
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+
+
+ The object to locate in the . The value can be for reference types.
+ The zero-based starting index of the backward search.
+ The number of elements in the section to search.
+ Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the that contains the specified number of elements and ends at the specified index.
+ The zero-based index of the last occurrence of within the range of elements in the that contains number of elements and ends at , if found; otherwise, -1.
+
+ is searched backward starting at `index` and ending at `index` minus `count` plus 1, if `count` is greater than 0.
+
+ This method determines equality using the default equality comparer 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 `count`.
+
+ ]]>
+
+
+ is outside the range of valid indexes for the .
+
+ -or-
+
+ is less than 0.
+
+ -or-
+
+ and do not specify a valid section in the .
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.ICollection`1.Remove(`0)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Boolean
+
+
+
+
+
+ The object to remove from the . The value can be for reference types.
+ Removes the first occurrence of a specific object from the .
+
+ if is successfully removed; otherwise, . This method also returns if was not found in the .
+
+ generic interface, the equality comparer is the method of that interface; otherwise, the default equality comparer is .
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates how to add, remove, and insert a simple business object in a .
-
+## Examples
+
+ The following example demonstrates how to add, remove, and insert a simple business object in a .
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs" id="Snippet1":::
-
- The following example demonstrates method. Several properties and methods of the generic class are used to add, insert, and search the list. After these operations, the list contains a duplicate. The method is used to remove the first instance of the duplicate item, and the contents are displayed. The method always removes the first instance it encounters.
-
+
+ The following example demonstrates method. Several properties and methods of the generic class are used to add, insert, and search the list. After these operations, the list contains a duplicate. The method is used to remove the first instance of the duplicate item, and the contents are displayed. The method always removes the first instance it encounters.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
-
-
-
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
- The delegate that defines the conditions of the elements to remove.
- Removes all the elements that match the conditions defined by the specified predicate.
- The number of elements removed from the .
-
- is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, and the elements that match the conditions are removed from the .
-
+
+ ]]>
+
+
+
+
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+ The delegate that defines the conditions of the elements to remove.
+ Removes all the elements that match the conditions defined by the specified predicate.
+ The number of elements removed from the .
+
+ is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, and the elements that match the conditions are removed from the .
+
This method performs a linear search; therefore, this method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the method and several other methods that use the generic delegate.
-
- A of strings is created, containing 8 dinosaur names, two of which (at positions 1 and 5) end with "saurus". The example also defines a search predicate method named `EndsWithSaurus`, which accepts a string parameter and returns a Boolean value indicating whether the input string ends in "saurus".
-
- The , , and methods are used to search the list with the search predicate method.
-
- The method is used to remove all entries ending with "saurus". It traverses the list from the beginning, passing each element in turn to the `EndsWithSaurus` method. The element is removed if the `EndsWithSaurus` method returns `true`.
-
+
+## Examples
+ The following example demonstrates the method and several other methods that use the generic delegate.
+
+ A of strings is created, containing 8 dinosaur names, two of which (at positions 1 and 5) end with "saurus". The example also defines a search predicate method named `EndsWithSaurus`, which accepts a string parameter and returns a Boolean value indicating whether the input string ends in "saurus".
+
+ The , , and methods are used to search the list with the search predicate method.
+
+ The method is used to remove all entries ending with "saurus". It traverses the list from the beginning, passing each element in turn to the `EndsWithSaurus` method. The element is removed if the `EndsWithSaurus` method returns `true`.
+
> [!NOTE]
-> In C# and Visual Basic, it is not necessary to create the `Predicate` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context, and create it automatically.
-
- Finally, the method verifies that there are no strings in the list that end with "saurus".
-
+> In C# and Visual Basic, it is not necessary to create the `Predicate` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context, and create it automatically.
+
+ Finally, the method verifies that there are no strings in the list that end with "saurus".
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Exists/source.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.IList`1.RemoveAt(System.Int32)
- M:System.Collections.IList.RemoveAt(System.Int32)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
- The zero-based index of the element to remove.
- Removes the element at the specified index of the .
-
- to remove an item, the remaining items in the list are renumbered to replace the removed item. For example, if you remove the item at index 3, the item at index 4 is moved to the 3 position. In addition, the number of items in the list (as represented by the property) is reduced by 1.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.IList`1.RemoveAt(System.Int32)
+ M:System.Collections.IList.RemoveAt(System.Int32)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+ The zero-based index of the element to remove.
+ Removes the element at the specified index of the .
+
+ to remove an item, the remaining items in the list are renumbered to replace the removed item. For example, if you remove the item at index 3, the item at index 4 is moved to the 3 position. In addition, the number of items in the list (as represented by the property) is reduced by 1.
+
This method is an O(*n*) operation, where *n* is ( - `index`).
-
-## Examples
- The following example demonstrates how to add, remove, and insert a simple business object in a .
-
+
+## Examples
+ The following example demonstrates how to add, remove, and insert a simple business object in a .
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/vb/module1.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.collections.generic.list.addremoveinsert/fs/addremoveinsert.fs" id="Snippet1":::
-
- ]]>
-
-
- is less than 0.
-
- -or-
-
- is equal to or greater than .
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
- The zero-based starting index of the range of elements to remove.
- The number of elements to remove.
- Removes a range of elements from the .
-
- have their indexes reduced by `count`.
-
+
+ ]]>
+
+
+ is less than 0.
+
+ -or-
+
+ is equal to or greater than .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ The zero-based starting index of the range of elements to remove.
+ The number of elements to remove.
+ Removes a range of elements from the .
+
+ have their indexes reduced by `count`.
+
This method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the method and various other methods of the class that act on ranges. After the list has been created and modified, the method is used to remove two elements from the list, beginning at index location 2.
-
+
+## Examples
+ The following example demonstrates the method and various other methods of the class that act on ranges. After the list has been created and modified, the method is used to remove two elements from the list, beginning at index location 2.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is less than 0.
-
- -or-
-
- is less than 0.
-
- and do not denote a valid range of elements in the .
-
-
-
-
-
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
-
-
- Reverses the order of the elements in the or a portion of it.
-
- method. The example creates a of strings and adds six strings. The method overload is used to reverse the list, and then the method overload is used to reverse the middle of the list, beginning with element 1 and encompassing four elements.
-
+
+ ]]>
+
+
+ is less than 0.
+
+ -or-
+
+ is less than 0.
+
+ and do not denote a valid range of elements in the .
+
+
+
+
+
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+
+
+ Reverses the order of the elements in the or a portion of it.
+
+ method. The example creates a of strings and adds six strings. The method overload is used to reverse the list, and then the method overload is used to reverse the middle of the list, beginning with element 1 and encompassing four elements.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Reverse/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Reverse/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
- Reverses the order of the elements in the entire .
-
- to reverse the order of the elements.
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+ Reverses the order of the elements in the entire .
+
+ to reverse the order of the elements.
+
This method is an O(*n*) operation, where *n* is .
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
- The zero-based starting index of the range to reverse.
- The number of elements in the range to reverse.
- Reverses the order of the elements in the specified range.
-
- to reverse the order of the elements.
-
- This method is an O(*n*) operation, where *n* is .
-
- ]]>
-
-
- is less than 0.
-
- -or-
-
- is less than 0.
-
- and do not denote a valid range of elements in the .
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 8.0.0.0
-
-
- mscorlib
-
-
- netstandard
-
-
- System.Collections.Generic.List<T>
-
-
-
-
-
-
- The zero-based index at which the range starts.
- The length of the range.
- Creates a shallow copy of a range of elements in the source .
- A shallow copy of a range of elements in the source .
- To be added.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ The zero-based starting index of the range to reverse.
+ The number of elements in the range to reverse.
+ Reverses the order of the elements in the specified range.
+
+ to reverse the order of the elements.
+
+ This method is an O(*n*) operation, where *n* is .
+
+ ]]>
+
+
+ is less than 0.
+
+ -or-
+
+ is less than 0.
+
+ and do not denote a valid range of elements in the .
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 8.0.0.0
+
+
+ mscorlib
+
+
+ netstandard
+
+
+ System.Collections.Generic.List<T>
+
+
+
+
+
+
+ The zero-based index at which the range starts.
+ The length of the range.
+ Creates a shallow copy of a range of elements in the source .
+ A shallow copy of a range of elements in the source .
+ To be added.
+
is less than 0.
-or-
- is less than 0.
-
- and do not denote a valid range of elements in the .
-
-
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
-
-
- Sorts the elements or a portion of the elements in the using either the specified or default implementation or a provided delegate to compare list elements.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
- Sorts the elements in the entire using the default comparer.
-
- for type `T` to determine the order of list elements. The property checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws an .
-
- This method uses the method, which applies the introspective sort as follows:
-
-- If the partition size is less than or equal to 16 elements, it uses an insertion sort algorithm.
-
-- If the number of partitions exceeds 2 log *n*, where *n* is the range of the input array, it uses a Heapsort algorithm.
-
-- Otherwise, it uses a Quicksort algorithm.
-
- This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.
-
+ is less than 0.
+
+ and do not denote a valid range of elements in the .
+
+
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+
+
+ Sorts the elements or a portion of the elements in the using either the specified or default implementation or a provided delegate to compare list elements.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+ Sorts the elements in the entire using the default comparer.
+
+ for type `T` to determine the order of list elements. The property checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws an .
+
+ This method uses the method, which applies the introspective sort as follows:
+
+- If the partition size is less than or equal to 16 elements, it uses an insertion sort algorithm.
+
+- If the number of partitions exceeds 2 log *n*, where *n* is the range of the input array, it uses a Heapsort algorithm.
+
+- Otherwise, it uses a Quicksort algorithm.
+
+ This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.
+
This method is an O(*n* log *n*) operation, where *n* is .
-
-## Examples
- The following example adds some names to a `List` object, displays the list in unsorted order, calls the method, and then displays the sorted list.
-
+## Examples
+
+ The following example adds some names to a `List` object, displays the list in unsorted order, calls the method, and then displays the sorted list.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Sort/Sort1.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/Sort1.vb" id="Snippet2":::
-
- The following code demonstrates the and method overloads on a simple business object. Calling the method results in the use of the default comparer for the Part type, and the method is implemented by using an anonymous method.
-
+
+ The following code demonstrates the and method overloads on a simple business object. Calling the method results in the use of the default comparer for the Part type, and the method is implemented by using an anonymous method.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Sort/program.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/module1.vb" id="Snippet1":::
-
- The following example demonstrates the method overload and the method overload. A of strings is created and populated with four strings, in no particular order. The list is displayed, sorted, and displayed again.
-
- The method overload is then used to search for two strings that are not in the list, and the method is used to insert them. The return value of the method is negative in each case, because the strings are not in the list. Taking the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of this negative number produces the index of the first element in the list that is larger than the search string, and inserting at this location preserves the sort order. The second search string is larger than any element in the list, so the insertion position is at the end of the list.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/module1.vb" id="Snippet1":::
+
+ The following example demonstrates the method overload and the method overload. A of strings is created and populated with four strings, in no particular order. The list is displayed, sorted, and displayed again.
+
+ The method overload is then used to search for two strings that are not in the list, and the method is used to insert them. The return value of the method is negative in each case, because the strings are not in the list. Taking the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of this negative number produces the index of the first element in the list that is larger than the search string, and inserting at this location preserves the sort order. The second search string is larger than any element in the list, so the insertion position is at the end of the list.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearch/vb/source.vb" id="Snippet1":::
-
- ]]>
-
- The default comparer cannot find an implementation of the generic interface or the interface for type .
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
-
-
-
-
-
- The implementation to use when comparing elements, or to use the default comparer .
- Sorts the elements in the entire using the specified comparer.
-
- are sorted using the specified implementation.
-
- If `comparer` is `null`, the default comparer checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws an .
-
- This method uses the method, which applies the introspective sort as follows:
-
-- If the partition size is less than or equal to 16 elements, it uses an insertion sort algorithm.
-
-- If the number of partitions exceeds 2 log *n*, where *n* is the range of the input array, it uses a Heapsort algorithm.
-
-- Otherwise, it uses a Quicksort algorithm.
-
- This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.
-
+
+ ]]>
+
+ The default comparer cannot find an implementation of the generic interface or the interface for type .
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
+
+
+
+
+
+ The implementation to use when comparing elements, or to use the default comparer .
+ Sorts the elements in the entire using the specified comparer.
+
+ are sorted using the specified implementation.
+
+ If `comparer` is `null`, the default comparer checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws an .
+
+ This method uses the method, which applies the introspective sort as follows:
+
+- If the partition size is less than or equal to 16 elements, it uses an insertion sort algorithm.
+
+- If the number of partitions exceeds 2 log *n*, where *n* is the range of the input array, it uses a Heapsort algorithm.
+
+- Otherwise, it uses a Quicksort algorithm.
+
+ This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.
+
This method is an O(*n* log *n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the method overload and the method overload.
-
- The example defines an alternative comparer for strings named DinoCompare, which implements the `IComparer` (`IComparer(Of String)` in Visual Basic, `IComparer` in Visual C++) generic interface. The comparer works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
-
- A of strings is created and populated with four strings, in no particular order. The list is displayed, sorted using the alternate comparer, and displayed again.
-
- The method overload is then used to search for several strings that are not in the list, employing the alternate comparer. The method is used to insert the strings. These two methods are located in the function named `SearchAndInsert`, along with code to take the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of the negative number returned by and use it as an index for inserting the new string.
-
+
+## Examples
+ The following example demonstrates the method overload and the method overload.
+
+ The example defines an alternative comparer for strings named DinoCompare, which implements the `IComparer` (`IComparer(Of String)` in Visual Basic, `IComparer` in Visual C++) generic interface. The comparer works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
+
+ A of strings is created and populated with four strings, in no particular order. The list is displayed, sorted using the alternate comparer, and displayed again.
+
+ The method overload is then used to search for several strings that are not in the list, employing the alternate comparer. The method is used to insert the strings. These two methods are located in the function named `SearchAndInsert`, along with code to take the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of the negative number returned by and use it as an index for inserting the new string.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearchComparer/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is , and the default comparer cannot find implementation of the generic interface or the interface for type .
- The implementation of caused an error during the sort. For example, might not return 0 when comparing an item with itself.
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
- The to use when comparing elements.
- Sorts the elements in the entire using the specified .
-
- are sorted using the method represented by the delegate.
-
- If `comparison` is `null`, an is thrown.
-
- This method uses , which applies the introspective sort as follows:
-
-- If the partition size is less than or equal to 16 elements, it uses an insertion sort algorithm
-
-- If the number of partitions exceeds 2 log *n*, where *n* is the range of the input array, it uses a [Heapsort](https://en.wikipedia.org/wiki/Heapsort) algorithm.
-
-- Otherwise, it uses a Quicksort algorithm.
-
- This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.
-
+
+ ]]>
+
+
+ is , and the default comparer cannot find implementation of the generic interface or the interface for type .
+ The implementation of caused an error during the sort. For example, might not return 0 when comparing an item with itself.
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+ The to use when comparing elements.
+ Sorts the elements in the entire using the specified .
+
+ are sorted using the method represented by the delegate.
+
+ If `comparison` is `null`, an is thrown.
+
+ This method uses , which applies the introspective sort as follows:
+
+- If the partition size is less than or equal to 16 elements, it uses an insertion sort algorithm
+
+- If the number of partitions exceeds 2 log *n*, where *n* is the range of the input array, it uses a [Heapsort](https://en.wikipedia.org/wiki/Heapsort) algorithm.
+
+- Otherwise, it uses a Quicksort algorithm.
+
+ This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.
+
This method is an O(*n* log *n*) operation, where *n* is .
-
-## Examples
- The following code demonstrates the and method overloads on a simple business object. Calling the method results in the use of the default comparer for the Part type, and the method is implemented using an anonymous method.
-
+
+## Examples
+ The following code demonstrates the and method overloads on a simple business object. Calling the method results in the use of the default comparer for the Part type, and the method is implemented using an anonymous method.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Sort/program.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/module1.vb" id="Snippet1":::
-
- The following example demonstrates the method overload.
-
- The example defines an alternative comparison method for strings, named `CompareDinosByLength`. This method works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
-
- A of strings is created and populated with four strings, in no particular order. The list also includes an empty string and a null reference. The list is displayed, sorted using a generic delegate representing the `CompareDinosByLength` method, and displayed again.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/module1.vb" id="Snippet1":::
+
+ The following example demonstrates the method overload.
+
+ The example defines an alternative comparison method for strings, named `CompareDinosByLength`. This method works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
+
+ A of strings is created and populated with four strings, in no particular order. The list also includes an empty string and a null reference. The list is displayed, sorted using a generic delegate representing the `CompareDinosByLength` method, and displayed again.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/ComparisonT/Overview/source.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortComparison/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
- The implementation of caused an error during the sort. For example, might not return 0 when comparing an item with itself.
-
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
-
-
-
-
-
- The zero-based starting index of the range to sort.
- The length of the range to sort.
- The implementation to use when comparing elements, or to use the default comparer .
- Sorts the elements in a range of elements in using the specified comparer.
-
- are sorted using the specified implementation.
-
- If `comparer` is `null`, the default comparer checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws an .
-
- This method uses , which applies the introspective sort as follows:
-
-- If the partition size is less than or equal to 16 elements, it uses an insertion sort algorithm
-
-- If the number of partitions exceeds 2 log *n*, where *n* is the range of the input array, it uses a [Heapsort](https://en.wikipedia.org/wiki/Heapsort) algorithm.
-
-- Otherwise, it uses a Quicksort algorithm.
-
- This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortComparison/vb/source.vb" id="Snippet1":::
+
+ ]]>
+
+
+ is .
+ The implementation of caused an error during the sort. For example, might not return 0 when comparing an item with itself.
+
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
+
+
+
+
+
+ The zero-based starting index of the range to sort.
+ The length of the range to sort.
+ The implementation to use when comparing elements, or to use the default comparer .
+ Sorts the elements in a range of elements in using the specified comparer.
+
+ are sorted using the specified implementation.
+
+ If `comparer` is `null`, the default comparer checks whether type `T` implements the generic interface and uses that implementation, if available. If not, checks whether type `T` implements the interface. If type `T` does not implement either interface, throws an .
+
+ This method uses , which applies the introspective sort as follows:
+
+- If the partition size is less than or equal to 16 elements, it uses an insertion sort algorithm
+
+- If the number of partitions exceeds 2 log *n*, where *n* is the range of the input array, it uses a [Heapsort](https://en.wikipedia.org/wiki/Heapsort) algorithm.
+
+- Otherwise, it uses a Quicksort algorithm.
+
+ This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.
+
This method is an O(*n* log *n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the method overload and the method overload.
-
- The example defines an alternative comparer for strings named DinoCompare, which implements the `IComparer` (`IComparer(Of String)` in Visual Basic, `IComparer` in Visual C++) generic interface. The comparer works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
-
- A of strings is created and populated with the names of five herbivorous dinosaurs and three carnivorous dinosaurs. Within each of the two groups, the names are not in any particular sort order. The list is displayed, the range of herbivores is sorted using the alternate comparer, and the list is displayed again.
-
- The method overload is then used to search only the range of herbivores for "Brachiosaurus". The string is not found, and the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of the negative number returned by the method is used as an index for inserting the new string.
-
+
+## Examples
+ The following example demonstrates the method overload and the method overload.
+
+ The example defines an alternative comparer for strings named DinoCompare, which implements the `IComparer` (`IComparer(Of String)` in Visual Basic, `IComparer` in Visual C++) generic interface. The comparer works as follows: First, the comparands are tested for `null`, and a null reference is treated as less than a non-null. Second, the string lengths are compared, and the longer string is deemed to be greater. Third, if the lengths are equal, ordinary string comparison is used.
+
+ A of strings is created and populated with the names of five herbivorous dinosaurs and three carnivorous dinosaurs. Within each of the two groups, the names are not in any particular sort order. The list is displayed, the range of herbivores is sorted using the alternate comparer, and the list is displayed again.
+
+ The method overload is then used to search only the range of herbivores for "Brachiosaurus". The string is not found, and the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) of the negative number returned by the method is used as an index for inserting the new string.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/BinarySearch/source2.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_SortSearchComparerRange/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is less than 0.
-
- -or-
-
- is less than 0.
-
- and do not specify a valid range in the .
-
- -or-
-
- The implementation of caused an error during the sort. For example, might not return 0 when comparing an item with itself.
-
- is , and the default comparer cannot find implementation of the generic interface or the interface for type .
- Performing Culture-Insensitive String Operations in Collections
-
-
-
-
-
-
-
-
-
- Property
-
- P:System.Collections.Generic.ICollection`1.IsReadOnly
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Boolean
-
-
- Gets a value indicating whether the is read-only.
-
- if the is read-only; otherwise, . In the default implementation of , this property always returns .
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.IEnumerable`1.GetEnumerator
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Collections.Generic.IEnumerator<T>
-
-
-
- Returns an enumerator that iterates through a 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.
-
- This method is an O(1) operation.
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.ICollection.CopyTo(System.Array,System.Int32)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Void
-
-
-
-
-
-
- The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
- The zero-based index in at which copying begins.
- Copies the elements of the to an , starting at a particular index.
-
-
+
+
+ is less than 0.
+
+ -or-
+
+ is less than 0.
+
+ and do not specify a valid range in the .
+
+ -or-
+
+ The implementation of caused an error during the sort. For example, might not return 0 when comparing an item with itself.
+
+ is , and the default comparer cannot find implementation of the generic interface or the interface for type .
+ Performing Culture-Insensitive String Operations in Collections
+
+
+
+
+
+
+
+
+
+ Property
+
+ P:System.Collections.Generic.ICollection`1.IsReadOnly
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Boolean
+
+
+ Gets a value indicating whether the is read-only.
+
+ if the is read-only; otherwise, . In the default implementation of , this property always returns .
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.Generic.IEnumerable`1.GetEnumerator
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Collections.Generic.IEnumerator<T>
+
+
+
+ Returns an enumerator that iterates through a 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.
+
+ This method is an O(1) operation.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.ICollection.CopyTo(System.Array,System.Int32)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
+ 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 nongeneric implementations of throw , whereas the generic implementations throw .
-
- This method is an O(*n*) operation, where *n* is .
-
- ]]>
-
-
- is .
-
- 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-
-
- The type of the source cannot be cast automatically to the type of the destination .
-
-
-
-
-
-
-
-
-
- Property
-
- P:System.Collections.ICollection.IsSynchronized
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Boolean
-
-
- Gets a value indicating whether access to the is synchronized (thread safe).
-
- 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. In the rare case where enumeration contends with write accesses, 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.
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
- Property
-
- P:System.Collections.ICollection.SyncRoot
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Object
-
-
- 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.
-
- 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
-```
-
+> If the type of the source cannot be cast automatically to the type of the destination `array`, the nongeneric implementations of throw , whereas the generic implementations throw .
+
+ This method is an O(*n*) operation, where *n* is .
+
+ ]]>
+
+
+ is .
+
+ 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-
+
+ The type of the source cannot be cast automatically to the type of the destination .
+
+
+
+
+
+
+
+
+
+ Property
+
+ P:System.Collections.ICollection.IsSynchronized
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Boolean
+
+
+ Gets a value indicating whether access to the is synchronized (thread safe).
+
+ 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. In the rare case where enumeration contends with write accesses, 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.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ P:System.Collections.ICollection.SyncRoot
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Object
+
+
+ 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.
+
+ 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.
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.IEnumerable.GetEnumerator
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Collections.IEnumerator
-
-
-
- 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, 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(1) operation.
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.IList.Add(System.Object)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Int32
-
-
-
-
-
- The to add to the .
- Adds an item to the .
- The position into which the new element was inserted.
-
- is less than , this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O(*n*) operation, where *n* is .
-
- ]]>
-
-
- is of a type that is not assignable to the .
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.IList.Contains(System.Object)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Boolean
-
-
-
-
-
- The to locate in the .
- Determines whether the contains a specific value.
-
- 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 .
-
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.IList.IndexOf(System.Object)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Int32
-
-
-
-
-
- The object to locate in the .
- Determines the index of a specific item in the .
- The index of if found in the list; otherwise, -1.
-
- 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 .
-
- ]]>
-
-
- is of a type that is not assignable to the .
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.IList.Insert(System.Int32,System.Object)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
- The zero-based index at which should be inserted.
- The object to insert into the .
- Inserts an item to the at the specified index.
-
- , then `item` is appended to the end.
-
- This method is an O(*n*) operation, where *n* is .
-
- ]]>
-
-
- is not a valid index in the .
-
- is of a type that is not assignable to the .
-
-
-
-
-
-
-
-
-
- Property
-
- P:System.Collections.IList.IsFixedSize
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Boolean
-
-
- Gets a value indicating whether the has a fixed size.
-
- if the has a fixed size; otherwise, . In the default implementation of , this property always returns .
-
-
-
-
-
-
-
-
-
-
-
-
- Property
-
- P:System.Collections.IList.IsReadOnly
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Boolean
-
-
- Gets a value indicating whether the is read-only.
-
- if the is read-only; otherwise, . In the default implementation of , this property always returns .
-
-
-
-
-
-
-
-
-
-
-
-
-
- Property
-
- P:System.Collections.IList.Item(System.Int32)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.Nullable(2)]
- [<System.Runtime.CompilerServices.Nullable(2)>]
-
-
-
- System.Object
-
-
-
-
-
- The zero-based index of the element to get or set.
- Gets or sets the element at the specified index.
- The element at the specified index.
-
- property. Visual Basic implements as a default property, which provides the same indexing functionality.
-
- Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.
-
- ]]>
-
-
- is not a valid index in the .
- The property is set and is of a type that is not assignable to the .
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.IList.Remove(System.Object)
-
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
- The object to remove from the .
- Removes the first occurrence of a specific object from the .
-
- 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 .
-
- ]]>
-
-
- is of a type that is not assignable to the .
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- T[]
-
-
-
- Copies the elements of the to a new array.
- An array containing copies of the elements of the .
-
- , which is an O(*n*) operation, where *n* is .
-
+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.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.IEnumerable.GetEnumerator
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Collections.IEnumerator
+
+
+
+ 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, 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(1) operation.
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.IList.Add(System.Object)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Int32
+
+
+
+
+
+ The to add to the .
+ Adds an item to the .
+ The position into which the new element was inserted.
+
+ is less than , this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O(*n*) operation, where *n* is .
+
+ ]]>
+
+
+ is of a type that is not assignable to the .
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.IList.Contains(System.Object)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Boolean
+
+
+
+
+
+ The to locate in the .
+ Determines whether the contains a specific value.
+
+ 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 .
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.IList.IndexOf(System.Object)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Int32
+
+
+
+
+
+ The object to locate in the .
+ Determines the index of a specific item in the .
+ The index of if found in the list; otherwise, -1.
+
+ 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 .
+
+ ]]>
+
+
+ is of a type that is not assignable to the .
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.IList.Insert(System.Int32,System.Object)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ The zero-based index at which should be inserted.
+ The object to insert into the .
+ Inserts an item to the at the specified index.
+
+ , then `item` is appended to the end.
+
+ This method is an O(*n*) operation, where *n* is .
+
+ ]]>
+
+
+ is not a valid index in the .
+
+ is of a type that is not assignable to the .
+
+
+
+
+
+
+
+
+
+ Property
+
+ P:System.Collections.IList.IsFixedSize
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Boolean
+
+
+ Gets a value indicating whether the has a fixed size.
+
+ if the has a fixed size; otherwise, . In the default implementation of , this property always returns .
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ P:System.Collections.IList.IsReadOnly
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Boolean
+
+
+ Gets a value indicating whether the is read-only.
+
+ if the is read-only; otherwise, . In the default implementation of , this property always returns .
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ P:System.Collections.IList.Item(System.Int32)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.Nullable(2)]
+ [<System.Runtime.CompilerServices.Nullable(2)>]
+
+
+
+ System.Object
+
+
+
+
+
+ The zero-based index of the element to get or set.
+ Gets or sets the element at the specified index.
+ The element at the specified index.
+
+ property. Visual Basic implements as a default property, which provides the same indexing functionality.
+
+ Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.
+
+ ]]>
+
+
+ is not a valid index in the .
+ The property is set and is of a type that is not assignable to the .
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.Collections.IList.Remove(System.Object)
+
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+ The object to remove from the .
+ Removes the first occurrence of a specific object from the .
+
+ 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 .
+
+ ]]>
+
+
+ is of a type that is not assignable to the .
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ T[]
+
+
+
+ Copies the elements of the to a new array.
+ An array containing copies of the elements of the .
+
+ , which is an O(*n*) operation, where *n* is .
+
This method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the method and other methods of the class that act on ranges. At the end of the example, the method is used to get three items from the list, beginning with index location 2. The method is called on the resulting , creating an array of three elements. The elements of the array are displayed.
-
+
+## Examples
+ The following example demonstrates the method and other methods of the class that act on ranges. At the end of the example, the method is used to get three items from the list, beginning with index location 2. The method is called on the resulting , creating an array of three elements. The elements of the array are displayed.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/.ctor/source1.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
- Sets the capacity to the actual number of elements in the , if that number is less than a threshold value.
-
- 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.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Ranges/vb/source.vb" id="Snippet1":::
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+ Sets the capacity to the actual number of elements in the , if that number is less than a threshold value.
+
+ 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.
+
> [!NOTE]
-> The current threshold of 90 percent might change in future releases.
-
- This method is an O(*n*) operation, where *n* is .
-
- To reset a to its initial state, call the method before calling the method. Trimming an empty sets the capacity of the to the default capacity.
-
+> The current threshold of 90 percent might change in future releases.
+
+ This method is an O(*n*) operation, where *n* is .
+
+ To reset a to its initial state, call the method before calling the method. Trimming an empty sets the capacity of the to the default capacity.
+
The capacity can also be set using the property.
-
-## Examples
- The following example demonstrates how to check the capacity and count of a that contains a simple business object, and illustrates using the method to remove extra capacity.
-
+## Examples
+
+ The following example demonstrates how to check the capacity and count of a that contains a simple business object, and illustrates using the method to remove extra capacity.
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Capacity/program.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.capacitycount/vb/module1.vb" id="Snippet1":::
-
- The following example demonstrates the method. Several properties and methods of the class are used to add, insert, and remove items from a list of strings. Then the method is used to reduce the capacity to match the count, and the and properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized. Finally, the contents of the list are cleared.
-
+
+ The following example demonstrates the method. Several properties and methods of the class are used to add, insert, and remove items from a list of strings. Then the method is used to reduce the capacity to match the count, and the and properties are displayed. If the unused capacity had been less than 10 percent of total capacity, the list would not have been resized. Finally, the contents of the list are cleared.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Overview/source.cs" interactive="try-dotnet-method" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_Class/vb/source.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR/List`1_Class/fs/listclass.fs" id="Snippet1":::
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Collections
- 4.0.0.0
- 4.0.10.0
- 4.1.0.0
- 4.1.1.0
- 4.1.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.0.0
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Boolean
-
-
-
-
-
- The delegate that defines the conditions to check against the elements.
- Determines whether every element in the matches the conditions defined by the specified predicate.
-
- if every element in the matches the conditions defined by the specified predicate; otherwise, . If the list has no elements, the return value is .
-
- is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, and processing is stopped when the delegate returns `false` for any element. The elements are processed in order, and all calls are made on a single thread.
-
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Collections
+ 4.0.0.0
+ 4.0.10.0
+ 4.1.0.0
+ 4.1.1.0
+ 4.1.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.0.0
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Boolean
+
+
+
+
+
+ The delegate that defines the conditions to check against the elements.
+ Determines whether every element in the matches the conditions defined by the specified predicate.
+
+ if every element in the matches the conditions defined by the specified predicate; otherwise, . If the list has no elements, the return value is .
+
+ is a delegate to a method that returns `true` if the object passed to it matches the conditions defined in the delegate. The elements of the current are individually passed to the delegate, and processing is stopped when the delegate returns `false` for any element. The elements are processed in order, and all calls are made on a single thread.
+
This method is an O(*n*) operation, where *n* is .
-
-## Examples
- The following example demonstrates the method and several other methods that use generic delegate.
-
- A of strings is created, containing 8 dinosaur names, two of which (at positions 1 and 5) end with "saurus". The example also defines a search predicate method named `EndsWithSaurus`, which accepts a string parameter and returns a Boolean value indicating whether the input string ends in "saurus".
-
- The method traverses the list from the beginning, passing each element in turn to the `EndsWithSaurus` method. The search stops when the `EndsWithSaurus` method returns `false`.
-
+
+## Examples
+ The following example demonstrates the method and several other methods that use generic delegate.
+
+ A of strings is created, containing 8 dinosaur names, two of which (at positions 1 and 5) end with "saurus". The example also defines a search predicate method named `EndsWithSaurus`, which accepts a string parameter and returns a Boolean value indicating whether the input string ends in "saurus".
+
+ The method traverses the list from the beginning, passing each element in turn to the `EndsWithSaurus` method. The search stops when the `EndsWithSaurus` method returns `false`.
+
> [!NOTE]
-> In C# and Visual Basic, it is not necessary to create the `Predicate` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context and create it automatically.
-
+> In C# and Visual Basic, it is not necessary to create the `Predicate` delegate (`Predicate(Of String)` in Visual Basic) explicitly. These languages infer the correct delegate from context and create it automatically.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/ListT/Exists/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/List`1_FindEtAl/vb/source.vb" id="Snippet1":::
-
- ]]>
-
-
- is .
-
-
-
-
-
-
+
+ ]]>
+
+
+ is .
+
+
+
+
+
+
diff --git a/xml/System.Collections.ObjectModel/ObservableCollection`1.xml b/xml/System.Collections.ObjectModel/ObservableCollection`1.xml
index d719c842b94..cbf4aae60d9 100644
--- a/xml/System.Collections.ObjectModel/ObservableCollection`1.xml
+++ b/xml/System.Collections.ObjectModel/ObservableCollection`1.xml
@@ -89,38 +89,9 @@
The type of elements in the collection.
Represents a dynamic data collection that provides notifications when items get added or removed, or when the whole list is refreshed.
-
- such as a , , or to display a collection of records.
-
- You can enumerate over any collection that implements the interface. However, to set up dynamic bindings so that insertions or deletions in the collection update the UI automatically, the collection must implement the interface. This interface exposes the event, an event that should be raised whenever the underlying collection changes.
-
- WPF provides the class, which is a built-in implementation of a data collection that implements the interface.
-
- Before implementing your own collection, consider using or one of the existing collection classes, such as , , and , among many others. If you have an advanced scenario and want to implement your own collection, consider using , which provides a non-generic collection of objects that can be individually accessed by index. Implementing provides the best performance with the data binding engine.
-
-> [!NOTE]
-> To fully support transferring data values from binding source objects to binding targets, each object in your collection that supports bindable properties must implement an appropriate property changed notification mechanism such as the interface.
-
- For more information, see "Binding to Collections" in [Data Binding Overview](/dotnet/framework/wpf/data/data-binding-overview).
-
-## Notes on XAML Usage
- can be used as a XAML object element in Windows Presentation Foundation (WPF), in versions 3.0 and 3.5. However, the usage has substantial limitations.
-
-- must be the root element, because the `x:TypeArguments` attribute that must be used to specify the constrained type of the generic is only supported on the object element for the root element.
-
-- You must declare an `x:Class` attribute (which entails that the build action for this XAML file must be `Page` or some other build action that compiles the XAML).
-
-- is in a namespace and assembly that are not initially mapped to the default XML namespace. You must map a prefix for the namespace and assembly, and then use that prefix on the object element tag for .
-
- A more straightforward way to use capabilities from XAML in an application is to declare your own non-generic custom collection class that derives from , and constrains it to a specific type. Then map the assembly that contains this class, and reference it as an object element in your XAML.
- ]]>
-
+ For more information about this API, see Supplemental API remarks for ObservableCollection<T>.
- Data Binding Demo
@@ -226,11 +197,11 @@
The collection from which the elements are copied.
Initializes a new instance of the class that contains elements copied from the specified collection.
- in the same order they are read by the enumerator of the collection.
-
+ in the same order they are read by the enumerator of the collection.
+
]]>
The parameter cannot be .
@@ -284,11 +255,11 @@
The list from which the elements are copied.
Initializes a new instance of the class that contains elements copied from the specified list.
- in the same order they are read by the enumerator of the list.
-
+ in the same order they are read by the enumerator of the list.
+
]]>
The parameter cannot be .
@@ -345,14 +316,14 @@
Disallows reentrant attempts to change this collection.
An object that can be used to dispose of the object.
- call within a `using` scope, as in the following example:
-
+ call within a `using` scope, as in the following example:
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.ObjectModel/ObservableCollectionT/BlockReentrancy/DataSource.cs" id="Snippetblockreentrancy":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ObservableCollection_snip/visualbasic/datasource.vb" id="Snippetblockreentrancy":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ObservableCollection_snip/visualbasic/datasource.vb" id="Snippetblockreentrancy":::
+
]]>
@@ -450,13 +421,13 @@
Removes all items from the collection.
- event.
-
- For more information, see the method of the base class.
-
+ event.
+
+ For more information, see the method of the base class.
+
]]>
@@ -568,13 +539,13 @@
The object to insert.
Inserts an item into the collection at the specified index.
- event.
-
- For more information, see the method of the base class.
-
+ event.
+
+ For more information, see the method of the base class.
+
]]>
@@ -634,11 +605,11 @@
The zero-based index specifying the new location of the item.
Moves the item at the specified index to a new location in the collection.
- method to provide custom behavior for this method.
-
+ method to provide custom behavior for this method.
+
]]>
@@ -692,13 +663,13 @@
The zero-based index specifying the new location of the item.
Moves the item at the specified index to a new location in the collection.
- event.
-
- Subclasses can override this protected method to provide custom behavior for the method.
-
+ event.
+
+ Subclasses can override this protected method to provide custom behavior for the method.
+
]]>
@@ -756,19 +727,19 @@
Arguments of the event being raised.
Raises the event with the provided arguments.
- event through this `virtual` method.
-
-
-
-## Examples
- When overriding this method, either call the base implementation or use the method to handle reentrant collection changes, as in the following example:
-
+ event through this `virtual` method.
+
+
+
+## Examples
+ When overriding this method, either call the base implementation or use the method to handle reentrant collection changes, as in the following example:
+
:::code language="csharp" source="~/snippets/csharp/System.Collections.ObjectModel/ObservableCollectionT/BlockReentrancy/DataSource.cs" id="Snippetblockreentrancy":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ObservableCollection_snip/visualbasic/datasource.vb" id="Snippetblockreentrancy":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Wpf/ObservableCollection_snip/visualbasic/datasource.vb" id="Snippetblockreentrancy":::
+
]]>
@@ -926,13 +897,13 @@
The zero-based index of the element to remove.
Removes the item at the specified index of the collection.
- event.
-
- For more information, see the method of the base class.
-
+ event.
+
+ For more information, see the method of the base class.
+
]]>
@@ -992,13 +963,13 @@
The new value for the element at the specified index.
Replaces the element at the specified index.
- event.
-
- For more information, see the method of the base class.
-
+ event.
+
+ For more information, see the method of the base class.
+
]]>
diff --git a/xml/System.Data.Linq.Mapping/TableAttribute.xml b/xml/System.Data.Linq.Mapping/TableAttribute.xml
index 3e4f9b8f3e8..3bf727f0eba 100644
--- a/xml/System.Data.Linq.Mapping/TableAttribute.xml
+++ b/xml/System.Data.Linq.Mapping/TableAttribute.xml
@@ -22,37 +22,7 @@
Designates a class as an entity class that is associated with a database table.
-
- attribute as persistent classes.
-
- LINQ to SQL supports only single-table mapping. That is, an entity class must be mapped to exactly one database table, and you cannot map a database table to multiple classes at the same time.
-
- You can use the property of the attribute to specify a name for the table, and you can optionally use the schema name to qualify a table name. If you do not specify a name by using the property, the table name is assumed to be the same as the class name.
-
-## Schema-qualified Names
- You can optionally use the schema name to qualify a table name. By default, the token to the left of the first period in the string is considered to be the schema name. The remainder of the name is considered to be the table name. The provider quotes the table name as appropriate. For example, the LINQ to SQL provider for SQL Server makes sure that brackets are used at least where they are needed.
-
-> [!NOTE]
-> In some cases, you must explicitly quote attributes because the SQL Server provider cannot auto-quote. The following table shows some examples.
-
-|Case|Example: Identifier Name|Example: Expected String in Attributes|Otherwise…|
-|----------|------------------------------|--------------------------------------------|----------------|
-|Schema name contains a period|Schema: "A.B"
Table: "C"|"[A.B].C"|The first period is assumed to separate the schema name from the table name.|
-|Schema/Table name starts with `@`|"@SomeName"|"[@SomeName]"|Assumed to be a parameter name.|
-|Schema starts with `[` and ends with `]`|"[Schema.Table]"|"[[Schema].[Table]]]"|The unquoted identifier resembles a quoted identifier.|
-|Table starts with `[` and ends with `]`|"[Table]"|"[[Table]]]"|The unquoted identifier resembles a quoted identifier.|
-
-
-
-## Examples
- :::code language="csharp" source="~/snippets/csharp/System.Data.Linq.Mapping/TableAttribute/Overview/Program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/DLinqCustomize/vb/Module1.vb" id="Snippet1":::
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for TableAttribute.
@@ -109,22 +79,22 @@
Gets or sets the name of the table or view.
By default, the value is the same as the name of the class.
- , the table name is assumed to be the same as the class name.
-
+ , the table name is assumed to be the same as the class name.
+
> [!NOTE]
-> You can optionally use a schema name to qualify the table name (for example, Schema3.Table5). By default, the token to the left of the first period in the string is considered to be the schema name, and the rest to be the table name.
-
- In the following example, the default table name, `Customer`, is changed to `Customers`.
-
-
-
-## Examples
+> You can optionally use a schema name to qualify the table name (for example, Schema3.Table5). By default, the token to the left of the first period in the string is considered to be the schema name, and the rest to be the table name.
+
+ In the following example, the default table name, `Customer`, is changed to `Customers`.
+
+
+
+## Examples
:::code language="csharp" source="~/snippets/csharp/System.Data.Linq.Mapping/TableAttribute/Overview/Program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/DLinqCustomize/vb/Module1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/DLinqCustomize/vb/Module1.vb" id="Snippet1":::
+
]]>
diff --git a/xml/System.Data.Linq/DataLoadOptions.xml b/xml/System.Data.Linq/DataLoadOptions.xml
index 1cd112eae76..f0a38586ce7 100644
--- a/xml/System.Data.Linq/DataLoadOptions.xml
+++ b/xml/System.Data.Linq/DataLoadOptions.xml
@@ -16,73 +16,7 @@
Provides for immediate loading and filtering of related data.
-
- class provides two methods to achieve immediate loading of specified related data. The method allows for immediate loading of data related to the main target. The method allows for filtering related objects.
-
-## Rules
- Note the following rules regarding usage:
-
-- Assigning a to a after the first query has been executed generates an exception.
-
-- Modifying a after it has been assigned to a generates an exception
-
-## Cycle Handling
- and directives must not create cycles. The following represent examples of such graphs:
-
-- Example 1: Self recursive
-
- - `dlo.LoadWith(e => e.Reports);`
-
-- Example 2: Back-pointers
-
- - `dlo.LoadWith (c => C.Orders);`
-
- - `dlo.LoadWith (o => o.Customer);`
-
-- Example 3: Longer cycles
-
- Although this should not occur in a well-normalized model, it is possible.
-
- - `dlo.LoadWith (a => a.Bs);`
-
- - `dlo.LoadWith (b => b.Cs);`
-
- - `dlo.LoadWith (c => c.As);`
-
-- Example 4: Self recursive subQueries
-
- - `dlo.AssociateWith(a=>a.As.Where(a=>a.Id=33));`
-
-- Example 5: Longer recursive subqueries
-
- - `dlo.AssociateWith(a=>a.Bs.Where(b=>b.Id==3));`
-
- - `dlo.AssociateWith(b=>b.As.Where(a=>a.Id==3));`
-
- The following are some general rules that help you understand what occurs in these scenarios.
-
- **LoadWith** Each call to checks whether cycles have been introduced into the graph. If there are, as in Examples 1, 2, and 3, an exception is thrown.
-
- **AssociateWith** The engine at run time does not apply the existing SubQuery clauses to the relationship inside the expression.
-
-- In Example 4, the `Where` clause is executed against all `A`, not just the ones sub-filtered by the SubQuery expression itself (because that would be recursive)
-
-- In Example 5, the first `Where` clause is applied to all the `B`s, even though there are subqueries on `B`. The second `Where` clause is applied to all the `A`s even though there are subqueries on `A`.
-
-
-
-## Examples
- When you retrieve `Customers` from the Northwind sample database, you can use to specify that `Orders` is also to be retrieved. You can even specify which subset of `Orders` to retrieve.
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for DataLoadOptions.
@@ -123,37 +57,37 @@
- Identifies the query to be used on a particular one-to-many field or property. Note the following:
-
- If the expression does not start with a field or property that represents a one-to-many relationship, an exception is thrown.
-
- If an operator other than a valid operator appears in the expression, an exception is thrown. Valid operators are as follows:
-
- Where
-
- OrderBy
-
- ThenBy
-
- OrderByDescending
-
- ThenByDescending
-
+ Identifies the query to be used on a particular one-to-many field or property. Note the following:
+
+ If the expression does not start with a field or property that represents a one-to-many relationship, an exception is thrown.
+
+ If an operator other than a valid operator appears in the expression, an exception is thrown. Valid operators are as follows:
+
+ Where
+
+ OrderBy
+
+ ThenBy
+
+ OrderByDescending
+
+ ThenByDescending
+
Take
Filters the objects retrieved for a particular relationship.
-
@@ -181,42 +115,42 @@
- The type that is queried against.
-
+ The type that is queried against.
+
If the type is unmapped, an exception is thrown.
- Identifies the query to be used on a particular one-to-many field or property. Note the following:
-
- If the expression does not start with a field or property that represents a one-to-many relationship, an exception is thrown.
-
- If an operator other than a valid operator appears in the expression, an exception is thrown. Valid operators are as follows:
-
- Where
-
- OrderBy
-
- ThenBy
-
- OrderByDescending
-
- ThenByDescending
-
+ Identifies the query to be used on a particular one-to-many field or property. Note the following:
+
+ If the expression does not start with a field or property that represents a one-to-many relationship, an exception is thrown.
+
+ If an operator other than a valid operator appears in the expression, an exception is thrown. Valid operators are as follows:
+
+ Where
+
+ OrderBy
+
+ ThenBy
+
+ OrderByDescending
+
+ ThenByDescending
+
Take
Filters objects retrieved for a particular relationship.
- .
-
-
-
-## Examples
- In the following example, the inner loop iterates only over those `Orders` that have not been shipped today.
-
+ .
+
+
+
+## Examples
+ In the following example, the inner loop iterates only over those `Orders` that have not been shipped today.
+
:::code language="csharp" source="~/snippets/csharp/System.Data.Linq/DataLoadOptions/AssociateWith/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/system.data.linq.dataloadoptions/vb/module1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/system.data.linq.dataloadoptions/vb/module1.vb" id="Snippet1":::
+
]]>
@@ -296,17 +230,17 @@
A lambda expression that identifies the related material.
Retrieves specified data related to the main target by using a lambda expression.
-
@@ -334,29 +268,29 @@
- Type that is queried against.
-
+ Type that is queried against.
+
If this type is unmapped, an exception is thrown.
- Identifies the field or property to be retrieved.
-
+ Identifies the field or property to be retrieved.
+
If the expression does not identify a field or property that represents a one-to-one or one-to-many relationship, an exception is thrown.
Specifies which sub-objects to retrieve when a query is submitted for an object of type T.
- methods.
-
- To avoid cycling, see Remarks section in .
-
-
-
-## Examples
- In the following example, all the `Orders` for all the `Customers` who are located in London are retrieved when the query is executed. As a result, successive access to the `Orders` property on a `Customer` object does not trigger a new database query.
-
+ methods.
+
+ To avoid cycling, see Remarks section in .
+
+
+
+## Examples
+ In the following example, all the `Orders` for all the `Customers` who are located in London are retrieved when the query is executed. As a result, successive access to the `Orders` property on a `Customer` object does not trigger a new database query.
+
:::code language="csharp" source="~/snippets/csharp/System.Data.Linq/DataLoadOptions/AssociateWith/program.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/system.data.linq.dataloadoptions/vb/module1.vb" id="Snippet2":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/system.data.linq.dataloadoptions/vb/module1.vb" id="Snippet2":::
+
]]>
diff --git a/xml/System.Data.Objects/MergeOption.xml b/xml/System.Data.Objects/MergeOption.xml
index 92cb13fd5b4..6cfc6721672 100644
--- a/xml/System.Data.Objects/MergeOption.xml
+++ b/xml/System.Data.Objects/MergeOption.xml
@@ -16,25 +16,26 @@
Specifies how objects being loaded into the object context are merged with objects already in the object context.
- objects are immutable objects that represent object's identity. Entity keys are used to perform identity resolution in the object context. For more information, see [Working with Entity Keys](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd283139(v=vs.100)). If an entity with the same identity is already being tracked, the data coming from the data source and the data already in the state manager are merged according to the of the query.
+ objects are immutable objects that represent object's identity. Entity keys are used to perform identity resolution in the object context. For more information, see [Working with Entity Keys](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd283139(v=vs.100)). If an entity with the same identity is already being tracked, the data coming from the data source and the data already in the state manager are merged according to the of the query.
+
+## Additional information on `MergeOption.PreserveChanges`
+
+If the state of the entity is , the current and original values in the entry are overwritten with data source values. The state of the entity remains and no properties are marked as modified.
+
+If the state of the entity is , the current values of modified properties are not overwritten with data source values. The original values of unmodified properties are overwritten with the values from the data source.
+
+In .NET Framework 4, Entity Framework compares the current values of unmodified properties with the values that were returned from the data source. If the values are not the same, the property is marked as modified.
+
+In .NET Framework 3.5 SP1, Entity Framework does not mark the property as modified even if the value in the data source is different.
+
+Only modified properties are persisted to the data source when you call .
+
+To preserve the .NET Framework 3.5 SP1 behavior, set to `true`. The `PreserveChanges` option can be used to resolve optimistic concurrency exceptions while preserving changes in the local context. For more information, see [Saving Changes and Managing Concurrency](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb738618(v=vs.100)).
- If the state of the entity is , the current and original values in the entry are overwritten with data source values. The state of the entity remains and no properties are marked as modified.
-
- If the state of the entity is , the current values of modified properties are not overwritten with data source values. The original values of unmodified properties are overwritten with the values from the data source.
-
- In .NET Framework 4, the Entity Framework compares the current values of unmodified properties with the values that were returned from the data source. If the values are not the same, the property is marked as modified.
-
- In .NET Framework 3.5 SP1, the Entity Framework does not mark the property as modified even if the value in the data source is different.
-
- Only modified properties are persisted to the data source when you call .
-
- To preserve the .NET Framework 3.5 SP1 behavior, set to `true`. The `PreserveChanges` option can be used to resolve optimistic concurrency exceptions while preserving changes in the local context. For more information, see [Saving Changes and Managing Concurrency](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb738618(v=vs.100)).
-
]]>
diff --git a/xml/System.Data/CommandBehavior.xml b/xml/System.Data/CommandBehavior.xml
index 5567fdaaa61..bb277d35e82 100644
--- a/xml/System.Data/CommandBehavior.xml
+++ b/xml/System.Data/CommandBehavior.xml
@@ -46,27 +46,7 @@
Provides a description of the results of the query and its effect on the database.
-
- method of and any implementing classes.
-
- A bitwise combination of these values may be used.
-
-`CommandBehavior` is ignored when used to define a or and should therefore not be used. Use the constructor that does not require a `CommandBehavior` parameter in these two cases.
-
-### Notes on individual enumeration members
-
-When using `KeyInfo`, the .NET Framework Data Provider for SQL Server precedes the statement being executed with `SET FMTONLY OFF` and `SET NO_BROWSETABLE ON`. The user should be aware of potential side effects, such as interference with the use of `SET FMTONLY ON` statements. For more information, see [SET FMTONLY (Transact-SQL)](/sql/t-sql/statements/set-fmtonly-transact-sql).
-
-> [!NOTE]
-> Use `SequentialAccess` to retrieve large values and binary data. Otherwise, an might occur and the connection will be closed.
-
-When you specify `SequentialAccess`, you are required to read from the columns in the order they are returned, although you are not required to read each column. Once you have read past a location in the returned stream of data, data at or before that location can no longer be read from the `DataReader`. When using the , you can reread the current column value until reading past it. When using the , you can read a column value only once.
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for CommandBehavior.
diff --git a/xml/System.Data/DataSet.xml b/xml/System.Data/DataSet.xml
index 054d86f63d2..46397da1d8b 100644
--- a/xml/System.Data/DataSet.xml
+++ b/xml/System.Data/DataSet.xml
@@ -136,48 +136,15 @@
Represents an in-memory cache of data.
-
- , which is an in-memory cache of data retrieved from a data source, is a major component of the ADO.NET architecture. The consists of a collection of objects that you can relate to each other with objects. You can also enforce data integrity in the by using the and objects. For further details about working with objects, see [DataSets, DataTables, and DataViews](/dotnet/framework/data/adonet/dataset-datatable-dataview/).
-
- Whereas objects contain the data, the allows you to navigate though the table hierarchy. The tables are contained in a accessed through the property. When accessing objects, note that they are conditionally case sensitive. For example, if one is named "mydatatable" and another is named "Mydatatable", a string used to search for one of the tables is regarded as case sensitive. However, if "mydatatable" exists and "Mydatatable" does not, the search string is regarded as case insensitive. For more information about working with objects, see [Creating a DataTable](/dotnet/framework/data/adonet/dataset-datatable-dataview/creating-a-datatable).
-
- A can read and write data and schema as XML documents. The data and schema can then be transported across HTTP and used by any application, on any platform that is XML-enabled. You can save the schema as an XML schema with the method, and both schema and data can be saved using the method. To read an XML document that includes both schema and data, use the method.
-
- In a typical multiple-tier implementation, the steps for creating and refreshing a , and in turn, updating the original data are to:
-
-1. Build and fill each in a with data from a data source using a .
-
-2. Change the data in individual objects by adding, updating, or deleting objects.
-
-3. Invoke the method to create a second that features only the changes to the data.
-
-4. Call the method of the , passing the second as an argument.
-
-5. Invoke the method to merge the changes from the second into the first.
-
-6. Invoke the on the . Alternatively, invoke to cancel the changes.
-
-> [!NOTE]
-> The and objects inherit from , and support the interface for remoting. These are the only ADO.NET objects that can be remoted.
-
-> [!NOTE]
-> Classes inherited from are not finalized by the garbage collector, because the finalizer has been suppressed in . The derived class can call the method in its constructor to allow the class to be finalized by the garbage collector.
-
-### Security considerations
-
-For information about DataSet and DataTable security, see [Security guidance](/dotnet/framework/data/adonet/dataset-datatable-dataview/security-guidance).
-
-## Examples
- The following example consists of several methods that, combined, create and fill a from the **Northwind** database.
-
- :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet Example/VB/source.vb" id="Snippet1":::
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for DataSet.
+
+ from the **Northwind** database.
+
+:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet Example/CS/source.cs" id="Snippet1":::
+:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet Example/VB/source.vb" id="Snippet1":::
+ ]]>
+
This type is safe for multithreaded read operations. You must synchronize any write operations.
Using DataSets in ADO.NET
@@ -226,20 +193,20 @@ For information about DataSet and DataTable security, see [Security guidance](/d
Initializes a new instance of the class.
- constructor takes no parameters, and creates a default name, "NewDataSet," for the new instance.
-
- A name for the is required to ensure that the XML representation of the always has a name for the document element, which is the highest-level element in a schema definition.
-
-
-
-## Examples
- The following example creates a new , and adds two objects to it.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.DataSet Example/VB/source.vb" id="Snippet1":::
-
+ constructor takes no parameters, and creates a default name, "NewDataSet," for the new instance.
+
+ A name for the is required to ensure that the XML representation of the always has a name for the document element, which is the highest-level element in a schema definition.
+
+
+
+## Examples
+ The following example creates a new , and adds two objects to it.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.DataSet Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -283,18 +250,18 @@ For information about DataSet and DataTable security, see [Security guidance](/d
The name of the .
Initializes a new instance of the class with the given name.
- is required to ensure that the XML representation of the always has a name for the document element, which is the highest level element in a schema definition.
-
-
-
-## Examples
- The following example creates a new , to which two objects are added.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.DataSet1 Example/VB/source.vb" id="Snippet1":::
-
+ is required to ensure that the XML representation of the always has a name for the document element, which is the highest level element in a schema definition.
+
+
+
+## Examples
+ The following example creates a new , to which two objects are added.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.DataSet1 Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -359,12 +326,12 @@ For information about DataSet and DataTable security, see [Security guidance](/d
Contextual information about the serialized stream.
Initializes a new instance of the class with serialized data.
-
.NET 7 and later versions only: contains binary data.
@@ -428,12 +395,12 @@ For information about DataSet and DataTable security, see [Security guidance](/d
To be added.
Initializes a new instance of the class with serialized data.
-
.NET 7 and later versions only: contains binary data.
@@ -476,28 +443,28 @@ For information about DataSet and DataTable security, see [Security guidance](/d
Commits all the changes made to this since it was loaded or since the last time was called.
- and classes have methods. Calling at the level causes the method for each to be called. Similarly, invoking on the causes to be called on each table within the . In this manner, you have multiple levels at which the method can be invoked. Calling the of the enables you to invoke the method on all subordinate objects (for example, tables and rows) with one call.
-
- When you call `AcceptChanges` on the `DataSet`, any objects still in edit-mode end their edits successfully. The property of each also changes; `Added` and `Modified` rows become `Unchanged`, and `Deleted` rows are removed.
-
- If the `DataSet` contains objects, invoking the `AcceptChanges` method also causes the to be enforced.
-
+ and classes have methods. Calling at the level causes the method for each to be called. Similarly, invoking on the causes to be called on each table within the . In this manner, you have multiple levels at which the method can be invoked. Calling the of the enables you to invoke the method on all subordinate objects (for example, tables and rows) with one call.
+
+ When you call `AcceptChanges` on the `DataSet`, any objects still in edit-mode end their edits successfully. The property of each also changes; `Added` and `Modified` rows become `Unchanged`, and `Deleted` rows are removed.
+
+ If the `DataSet` contains objects, invoking the `AcceptChanges` method also causes the to be enforced.
+
> [!NOTE]
-> `AcceptChanges` and `RejectChanges` only apply to `DataRow` related changes (that is, Add, Remove, Delete, and Modify). They are not applicable to schema or structural changes.
->
-> Calling AcceptChanges will not replicate these changes back to the data source if the DataSet was filled using a DataAdapter. In that situation, call instead. See [Updating Data Sources with DataAdapters](/dotnet/framework/data/adonet/updating-data-sources-with-dataadapters) for more information.
-
-
-
-## Examples
- The following example adds a to a in a . The method is then called on the , which cascades to all objects that it contains.
-
+> `AcceptChanges` and `RejectChanges` only apply to `DataRow` related changes (that is, Add, Remove, Delete, and Modify). They are not applicable to schema or structural changes.
+>
+> Calling AcceptChanges will not replicate these changes back to the data source if the DataSet was filled using a DataAdapter. In that situation, call instead. See [Updating Data Sources with DataAdapters](/dotnet/framework/data/adonet/updating-data-sources-with-dataadapters) for more information.
+
+
+
+## Examples
+ The following example adds a to a in a . The method is then called on the , which cascades to all objects that it contains.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.AcceptChanges/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.AcceptChanges/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.AcceptChanges/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -543,11 +510,11 @@ For information about DataSet and DataTable security, see [Security guidance](/d
Begins the initialization of a that is used on a form or used by another component. The initialization occurs at run time.
- method ends the initialization. Using the and methods prevents the control from being used before it is fully initialized.
-
+ method ends the initialization. Using the and methods prevents the control from being used before it is fully initialized.
+
]]>
Using DataSets in ADO.NET
@@ -601,20 +568,20 @@ For information about DataSet and DataTable security, see [Security guidance](/d
if string comparisons are case-sensitive; otherwise, . The default is .
- property affects how sorting, searching, and filtering operations are performed on each object contained in a when using the method.
-
- By default, setting the property for a also sets the property of each associated to the same value.
-
-
-
-## Examples
- The following example toggles the property.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.CaseSensitive Example/VB/source.vb" id="Snippet1":::
-
+ property affects how sorting, searching, and filtering operations are performed on each object contained in a when using the method.
+
+ By default, setting the property for a also sets the property of each associated to the same value.
+
+
+
+## Examples
+ The following example toggles the property.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.CaseSensitive Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -657,19 +624,19 @@ For information about DataSet and DataTable security, see [Security guidance](/d
Clears the of any data by removing all rows in all tables.
- is bound to an , calling or raises the . To avoid this situation, traverse each table, removing each row one at a time.
-
-
-
-## Examples
- The following example clears the of all rows in all tables.
-
+ is bound to an , calling or raises the . To avoid this situation, traverse each table, removing each row one at a time.
+
+
+
+## Examples
+ The following example clears the of all rows in all tables.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Clear Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Clear Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Clear Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -713,21 +680,21 @@ For information about DataSet and DataTable security, see [Security guidance](/d
Copies the structure of the , including all schemas, relations, and constraints. Does not copy any data.
A new with the same schema as the current , but none of the data.
- [!NOTE]
-> If these classes have been subclassed, the clone will also be of the same subclasses.
-
-
-
-## Examples
- The following example creates a clone of a object's schema.
-
+> If these classes have been subclassed, the clone will also be of the same subclasses.
+
+
+
+## Examples
+ The following example creates a clone of a object's schema.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Clone Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Clone Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Clone Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -777,13 +744,13 @@ For information about DataSet and DataTable security, see [Security guidance](/d
## Remarks
If these classes have been subclassed, the copy will also be of the same subclasses.
-
-## Examples
- The following example uses the method to create a copy of the original .
-
+
+## Examples
+ The following example uses the method to create a copy of the original .
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Copy Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Copy Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Copy Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -799,24 +766,24 @@ If these classes have been subclassed, the copy will also be of the same subclas
Returns a with one result set per , in the same sequence as the tables appear in the collection.
- , if a within the is empty, it will be represented by an empty result set within the returned `DataTableReader`.
-
-
-
-## Examples
- This example, a Console application, creates three instances and adds each to a . The example calls the method and displays the contents of the returned . Note that the order of the result sets in the `DataTableReader` is controlled by the order of the `DataTable` instances passed as parameters.
-
+ , if a within the is empty, it will be represented by an empty result set within the returned `DataTableReader`.
+
+
+
+## Examples
+ This example, a Console application, creates three instances and adds each to a . The example calls the method and displays the contents of the returned . Note that the order of the result sets in the `DataTableReader` is controlled by the order of the `DataTable` instances passed as parameters.
+
> [!NOTE]
-> This example shows how to use one of the overloaded versions of `CreateDataReader`. For other examples that might be available, see the individual overload topics.
-
+> This example shows how to use one of the overloaded versions of `CreateDataReader`. For other examples that might be available, see the individual overload topics.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.CreateDataReader/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.CreateDataReader/VB/source.vb" id="Snippet1":::
-
- The example displays the following code in the Console window:
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.CreateDataReader/VB/source.vb" id="Snippet1":::
+
+ The example displays the following code in the Console window:
+
]]>
Using DataSets in ADO.NET
@@ -859,19 +826,19 @@ If these classes have been subclassed, the copy will also be of the same subclas
Returns a with one result set per , in the same sequence as the tables appear in the collection.
A containing one or more result sets, corresponding to the instances contained within the source .
- , if a within the is empty, it is represented by an empty result set within the returned `DataTableReader`.
-
-
-
-## Examples
- The following example creates three instances, and adds each to a . The example then passes the filled `DataSet` to a procedure that calls the method, and proceeds to iterate through all the result sets contained within the . The example displays the results in the Console window.
-
+ , if a within the is empty, it is represented by an empty result set within the returned `DataTableReader`.
+
+
+
+## Examples
+ The following example creates three instances, and adds each to a . The example then passes the filled `DataSet` to a procedure that calls the method, and proceeds to iterate through all the result sets contained within the . The example displays the results in the Console window.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.DataTableReader/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.DataTableReader/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.DataTableReader/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -924,19 +891,19 @@ If these classes have been subclassed, the copy will also be of the same subclas
Returns a with one result set per .
A containing one or more result sets, corresponding to the instances contained within the source . The returned result sets are in the order specified by the parameter.
- , if a within the is empty, it is represented by an empty result set within the returned `DataTableReader`. Because this overloaded version allows you to supply a list of `DataTable` instances as parameters, you can specify the order in which the result sets appear within the returned `DataTableReader`.
-
-
-
-## Examples
- This example, a Console application, creates three instances and adds each to a . The example calls the method and displays the contents of the returned . Note that the order of the result sets in the `DataTableReader` is controlled by the order of the `DataTable` instances passed as parameters. The example displays the results in the Console window.
-
+ , if a within the is empty, it is represented by an empty result set within the returned `DataTableReader`. Because this overloaded version allows you to supply a list of `DataTable` instances as parameters, you can specify the order in which the result sets appear within the returned `DataTableReader`.
+
+
+
+## Examples
+ This example, a Console application, creates three instances and adds each to a . The example calls the method and displays the contents of the returned . Note that the order of the result sets in the `DataTableReader` is controlled by the order of the `DataTable` instances passed as parameters. The example displays the results in the Console window.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.DataTableReaderTables/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.DataTableReaderTables/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.DataTableReaderTables/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -989,14 +956,14 @@ If these classes have been subclassed, the copy will also be of the same subclas
Gets or sets the name of the current .
The name of the .
- with the given .
-
+ with the given .
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.DataSetName Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.DataSetName Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.DataSetName Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -1049,20 +1016,20 @@ If these classes have been subclassed, the copy will also be of the same subclas
Gets a custom view of the data contained in the to allow filtering, searching, and navigating using a custom .
A object.
- returned by the property allows you to create custom settings for each in the .
-
- When you obtain a from a , the sort order, filtering, and are configured according to the settings in the property.
-
-
-
-## Examples
- The following example gets the default for a , and adds a to the .
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.DefaultViewManager Example/VB/source.vb" id="Snippet1":::
-
+ returned by the property allows you to create custom settings for each in the .
+
+ When you obtain a from a , the sort order, filtering, and are configured according to the settings in the property.
+
+
+
+## Examples
+ The following example gets the default for a , and adds a to the .
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.DefaultViewManager Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -1077,11 +1044,11 @@ If these classes have been subclassed, the copy will also be of the same subclas
Determines the for a .
- to determine its .
-
+ to determine its .
+
]]>
Using DataSets in ADO.NET
@@ -1127,11 +1094,11 @@ If these classes have been subclassed, the copy will also be of the same subclas
Determines the for a .
An enumeration indicating whether schema information has been omitted from the payload.
- to determine its .
-
+ to determine its .
+
]]>
Using DataSets in ADO.NET
@@ -1179,11 +1146,11 @@ If these classes have been subclassed, the copy will also be of the same subclas
Determines the for a .
An enumeration indicating whether schema information has been omitted from the payload.
- to determine its .
-
+ to determine its .
+
]]>
Using DataSets in ADO.NET
@@ -1229,11 +1196,11 @@ If these classes have been subclassed, the copy will also be of the same subclas
Ends the initialization of a that is used on a form or used by another component. The initialization occurs at run time.
- method starts the initialization. Using the and methods prevents the control from being used before it is fully initialized.
-
+ method starts the initialization. Using the and methods prevents the control from being used before it is fully initialized.
+
]]>
Using DataSets in ADO.NET
@@ -1287,19 +1254,19 @@ If these classes have been subclassed, the copy will also be of the same subclas
if rules are enforced; otherwise, . The default is .
- level ( property). For more information about creating constraints, see [DataTable Constraints](/dotnet/framework/data/adonet/dataset-datatable-dataview/datatable-constraints).
-
-
-
-## Examples
- The following example creates a with one table, one column, five rows, and one . The property is set to `false` and the values of each row are set to the same value. When the property is reset to `true`, a is generated.
-
+ level ( property). For more information about creating constraints, see [DataTable Constraints](/dotnet/framework/data/adonet/dataset-datatable-dataview/datatable-constraints).
+
+
+
+## Examples
+ The following example creates a with one table, one column, five rows, and one . The property is set to `false` and the values of each row are set to the same value. When the property is reset to `true`, a is generated.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.EnforceConstraints Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.EnforceConstraints Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.EnforceConstraints Example/VB/source.vb" id="Snippet1":::
+
]]>
One or more constraints cannot be enforced.
@@ -1353,21 +1320,21 @@ If these classes have been subclassed, the copy will also be of the same subclas
Gets the collection of customized user information associated with the .
A with all custom user information.
- property enables you to store custom information with the `DataSet`. For example, you might store a time when the data should be refreshed.
-
- Extended properties must be of type if you want them persisted when the is written as XML.
-
-
-
-## Examples
- The following example adds a custom property to the returned by the property. The second example retrieves the custom property.
-
+ property enables you to store custom information with the `DataSet`. For example, you might store a time when the data should be refreshed.
+
+ Extended properties must be of type if you want them persisted when the is written as XML.
+
+
+
+## Examples
+ The following example adds a custom property to the returned by the property. The second example retrieves the custom property.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataColumn.ExtendedProperties Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataColumn.ExtendedProperties Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataColumn.ExtendedProperties Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -1429,19 +1396,19 @@ If these classes have been subclassed, the copy will also be of the same subclas
Gets a copy of the that contains all changes made to it since it was loaded or since was last called.
A copy of the changes from this that can have actions performed on it and later be merged back in using . If no changed rows are found, the method returns .
- that contains a copy of all rows in the original that have pending changes. Relationship constraints can cause additional unchanged rows to be added to the new if the unchanged rows contain primary keys corresponding to foreign keys in the changed rows. The method returns `null` if there are no rows in the original that have pending changes.
-
-
-
-## Examples
- The following example creates a simple with one table, two columns, and ten rows. Two values are changed, and one row is added. A subset of the changed data is created using the method. After reconciling errors, a new column is added to the subset, changing the schema. When the method is called with the `missingSchemaAction` set to `MissingSchemaAction.Add`, the new column is added to the original object's schema.
-
+ that contains a copy of all rows in the original that have pending changes. Relationship constraints can cause additional unchanged rows to be added to the new if the unchanged rows contain primary keys corresponding to foreign keys in the changed rows. The method returns `null` if there are no rows in the original that have pending changes.
+
+
+
+## Examples
+ The following example creates a simple with one table, two columns, and ten rows. Two values are changed, and one row is added. A subset of the changed data is created using the method. After reconciling errors, a new column is added to the subset, changing the schema. When the method is called with the `missingSchemaAction` set to `MissingSchemaAction.Add`, the new column is added to the original object's schema.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -1496,21 +1463,21 @@ If these classes have been subclassed, the copy will also be of the same subclas
Gets a copy of the containing all changes made to it since it was last loaded, or since was called, filtered by .
A filtered copy of the that can have actions performed on it, and subsequently be merged back in using . If no rows of the desired are found, the method returns .
- method is used to produce a second object that contains only the changes introduced into the original. Use the `rowStates` argument to specify the type of changes the new object should include.
-
- This returned copy is designed to be merged back in to this original . Relationship constraints may cause parent rows marked `Unchanged` to be included. If no rows of the desired are found, the method returns `null`.
-
-
-
-## Examples
- The following example uses the method to create a second object, which is then used to update a data source.
-
+ method is used to produce a second object that contains only the changes introduced into the original. Use the `rowStates` argument to specify the type of changes the new object should include.
+
+ This returned copy is designed to be merged back in to this original . Relationship constraints may cause parent rows marked `Unchanged` to be included. If no rows of the desired are found, the method returns `null`.
+
+
+
+## Examples
+ The following example uses the method to create a second object, which is then used to update a data source.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges1 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges1 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges1 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -1769,344 +1736,344 @@ If these classes have been subclassed, the copy will also be of the same subclas
Returns the XML representation of the data stored in the .
A string that is a representation of the data stored in the .
- with set to .
-
- returns XML as a string, and therefore requires more overhead than to write XML to a file.
-
- If you build a using schema inference and serialize it using XML or Web services, the column ordering may change.
-
-
-
-## Examples
- The following example creates a and , adds sample data, and then displays the data in XML format.
-
+ with set to .
+
+ returns XML as a string, and therefore requires more overhead than to write XML to a file.
+
+ If you build a using schema inference and serialize it using XML or Web services, the column ordering may change.
+
+
+
+## Examples
+ The following example creates a and , adds sample data, and then displays the data in XML format.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.GetXml Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetXml Example/VB/source.vb" id="Snippet1":::
-
- This sample demonstrates how to write data into an XML file from a DataSet and read data into DataSet from XML. This sample will create one dataset with two tables, use two ways to export a dataset into the XML files (WriteXml and GetXml), and use two ways (ReadXml and InferXmlSchema) to import a dataset from the XML files.
-
- Before you compile and run the sample, you need to create four XML files in the sample directory. First, create ElementsWithAttributes.xml:
-
-```xml
-
- New
-
-
- Cancelled
-
-```
-
- Next, create ElementsWithChildElementsxml.xml:
-
-```xml
-
-
- C1045
- 2012
- Calculus
- 4
- 7
-
-
- C1061
- 2012
- Physics
- 4
- 1
-
-
- C2021
- 2012
- Composition
- 3
- 2
-
-
- C2042
- 2012
- Literature
- 4
- 2
-
-
- 1
- Engineering
- 350000
- 2007-09-01T00:00:00+08:00
- 2
-
-
- 2
- English
- 120000
- 2007-09-01T00:00:00+08:00
- 6
-
-
- 4
- Economics
- 200000
- 2007-09-01T00:00:00+08:00
- 4
-
-
- 7
- Mathematics
- 250024
- 2007-09-01T00:00:00+08:00
- 3
-
-
-```
-
- Now create ElementsWithOnlyAttributes.xml:
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetXml Example/VB/source.vb" id="Snippet1":::
+
+ This sample demonstrates how to write data into an XML file from a DataSet and read data into DataSet from XML. This sample will create one dataset with two tables, use two ways to export a dataset into the XML files (WriteXml and GetXml), and use two ways (ReadXml and InferXmlSchema) to import a dataset from the XML files.
+
+ Before you compile and run the sample, you need to create four XML files in the sample directory. First, create ElementsWithAttributes.xml:
+
```xml
-
-
-
-
-
-
-```
-
- And finally, create RepeatingElements.xml:
-
+
+ New
+
+
+ Cancelled
+
+```
+
+ Next, create ElementsWithChildElementsxml.xml:
+
+```xml
+
+
+ C1045
+ 2012
+ Calculus
+ 4
+ 7
+
+
+ C1061
+ 2012
+ Physics
+ 4
+ 1
+
+
+ C2021
+ 2012
+ Composition
+ 3
+ 2
+
+
+ C2042
+ 2012
+ Literature
+ 4
+ 2
+
+
+ 1
+ Engineering
+ 350000
+ 2007-09-01T00:00:00+08:00
+ 2
+
+
+ 2
+ English
+ 120000
+ 2007-09-01T00:00:00+08:00
+ 6
+
+
+ 4
+ Economics
+ 200000
+ 2007-09-01T00:00:00+08:00
+ 4
+
+
+ 7
+ Mathematics
+ 250024
+ 2007-09-01T00:00:00+08:00
+ 3
+
+
+```
+
+ Now create ElementsWithOnlyAttributes.xml:
+
+```xml
+
+
+
+
+
+
+```
+
+ And finally, create RepeatingElements.xml:
+
```xml
-
- C1045
- C1061
- Engineering
- Mathematics
-
-```
-
+
+ C1045
+ C1061
+ Engineering
+ Mathematics
+
+```
+
Now you can compile and run the following source code.
-
+
```csharp
-using System;
-using System.Data;
-using System.IO;
-using System.Text;
-using System.Xml;
-
-// Use WriteXml method to export the dataset.
-static class DataTableHelper {
- public static void WriteDataSetToXML(DataSet dataset, String xmlFileName) {
- using (FileStream fsWriterStream = new FileStream(xmlFileName, FileMode.Create)) {
- using (XmlTextWriter xmlWriter = new XmlTextWriter(fsWriterStream, Encoding.Unicode)) {
- dataset.WriteXml(xmlWriter, XmlWriteMode.WriteSchema);
- Console.WriteLine("Write {0} to the File {1}.", dataset.DataSetName, xmlFileName);
- Console.WriteLine();
- }
- }
- }
-
- // Use GetXml method to get the XML data of the dataset and then export to the file.
- public static void GetXMLFromDataSet(DataSet dataset, String xmlFileName) {
- using (StreamWriter writer = new StreamWriter(xmlFileName)) {
- writer.WriteLine(dataset.GetXml());
- Console.WriteLine("Get Xml data from {0} and write to the File {1}.", dataset.DataSetName, xmlFileName);
- Console.WriteLine();
- }
- }
-
- // Use ReadXml method to import the dataset from the dataset.
- public static void ReadXmlIntoDataSet(DataSet newDataSet, String xmlFileName) {
- using (FileStream fsReaderStream = new FileStream(xmlFileName, FileMode.Open)) {
- using (XmlTextReader xmlReader = new XmlTextReader(fsReaderStream)) {
- newDataSet.ReadXml(xmlReader, XmlReadMode.ReadSchema);
- }
- }
- }
-
- // Display the columns and value of DataSet.
- public static void ShowDataSet(DataSet dataset) {
- foreach (DataTable table in dataset.Tables) {
- Console.WriteLine("Table {0}:", table.TableName);
- ShowDataTable(table);
- }
- }
-
- // Display the columns and value of DataTable.
- private static void ShowDataTable(DataTable table) {
- foreach (DataColumn col in table.Columns) {
- Console.Write("{0,-14}", col.ColumnName);
- }
- Console.WriteLine("{0,-14}", "");
-
- foreach (DataRow row in table.Rows) {
- if (row.RowState == DataRowState.Deleted) {
- foreach (DataColumn col in table.Columns) {
- if (col.DataType.Equals(typeof(DateTime))) {
- Console.Write("{0,-14:d}", row[col, DataRowVersion.Original]);
- }
- else if (col.DataType.Equals(typeof(Decimal))) {
- Console.Write("{0,-14:C}", row[col, DataRowVersion.Original]);
- }
- else {
- Console.Write("{0,-14}", row[col, DataRowVersion.Original]);
- }
- }
- }
- else {
- foreach (DataColumn col in table.Columns) {
- if (col.DataType.Equals(typeof(DateTime))) {
- Console.Write("{0,-14:d}", row[col]);
- }
- else if (col.DataType.Equals(typeof(Decimal))) {
- Console.Write("{0,-14:C}", row[col]);
- }
- else {
- Console.Write("{0,-14}", row[col]);
- }
- }
- }
- Console.WriteLine("{0,-14}", "");
- }
- }
-
- // Display the columns of DataSet.
- public static void ShowDataSetSchema(DataSet dataSet) {
- Console.WriteLine("{0} contains the following tables:", dataSet.DataSetName);
- foreach (DataTable table in dataSet.Tables) {
- Console.WriteLine(" Table {0} contains the following columns:", table.TableName);
- ShowDataTableSchema(table);
- }
- }
-
- // Display the columns of DataTable
- private static void ShowDataTableSchema(DataTable table) {
- String columnString = "";
- foreach (DataColumn col in table.Columns) {
- columnString += col.ColumnName + " ";
- }
- Console.WriteLine(columnString);
- }
-}
-
-class Program {
- static void Main(string[] args) {
- // Create the DataSet
- DataSet school = new DataSet("MySchool");
- DataTable course = CreateCourse();
- DataTable department = CreateDepartment();
- school.Tables.Add(course);
- school.Tables.Add(department);
-
- // Define the constraint between the tables.
- ForeignKeyConstraint courseDepartFK = new ForeignKeyConstraint("CourseDepartFK", department.Columns["DepartmentID"], course.Columns["DepartmentID"]);
- courseDepartFK.DeleteRule = Rule.Cascade;
- courseDepartFK.UpdateRule = Rule.Cascade;
- courseDepartFK.AcceptRejectRule = AcceptRejectRule.None;
- course.Constraints.Add(courseDepartFK);
-
- InsertDepartments(department);
- InsertCourses(course);
-
- // Export the dataset to the XML file.
- Console.WriteLine("Data of the whole DataSet {0}", school.DataSetName);
- DataTableHelper.ShowDataSet(school);
-
- String xmlWithSchemaFileName = "WriterXMLWithSchema.xml";
- String xmlGetDataFileName = "GetXML.xml";
-
- // Use two ways to export the dataset to the Xml file.
- DataTableHelper.WriteDataSetToXML(school, xmlWithSchemaFileName);
- DataTableHelper.GetXMLFromDataSet(school, xmlGetDataFileName);
-
- // Import the dataset from the XML file.
- // Use two ways to import the dataset from the Xml file.
- Console.WriteLine("Read Xml document into a new DataSet:");
- DataSet newSchool = new DataSet("NewSchool");
- DataTableHelper.ReadXmlIntoDataSet(newSchool, xmlWithSchemaFileName);
- DataTableHelper.ShowDataSetSchema(newSchool);
- Console.WriteLine();
-
- Console.WriteLine("Infer a schema for a DataSet from an XML document:");
- InferDataSetSchemaFromXml();
-
- Console.WriteLine("Press any key to exit.");
- Console.ReadKey();
- }
-
- static DataTable CreateCourse() {
- DataTable course = new DataTable("Course");
- DataColumn[] cols ={
- new DataColumn("CourseID",typeof(String)),
- new DataColumn("Year",typeof(Int32)),
- new DataColumn("Title",typeof(String)),
- new DataColumn("Credits",typeof(Int32)),
- new DataColumn("DepartmentID",typeof(Int32))};
- course.Columns.AddRange(cols);
-
- course.PrimaryKey = new DataColumn[] { course.Columns["CourseID"], course.Columns["Year"] };
-
- return course;
- }
-
- static DataTable CreateDepartment() {
- DataTable department = new DataTable("Department");
- DataColumn[] cols = {
- new DataColumn("DepartmentID", typeof(Int32)),
- new DataColumn("Name",typeof(String)),
- new DataColumn("Budget",typeof(Decimal)),
- new DataColumn("StartDate",typeof(DateTime)),
- new DataColumn("Administrator",typeof(Int32))};
- department.Columns.AddRange(cols);
-
- department.PrimaryKey = new DataColumn[] { department.Columns["DepartmentID"] };
-
- return department;
- }
-
- static void InsertDepartments(DataTable department) {
- Object[] rows = {
- new Object[]{1,"Engineering",350000.00,new DateTime(2007,9,1),2},
- new Object[]{2,"English",120000.00,new DateTime(2007,9,1),6},
- new Object[]{4,"Economics",200000.00,new DateTime(2007,9,1),4},
- new Object[]{7,"Mathematics",250024.00,new DateTime(2007,9,1),3}};
-
- foreach (Object[] row in rows) {
- department.Rows.Add(row);
- }
- }
-
- static void InsertCourses(DataTable course) {
- Object[] rows ={
- new Object[]{"C1045",2012,"Calculus",4,7},
- new Object[]{"C1061",2012,"Physics",4,1},
- new Object[]{"C2021",2012,"Composition",3,2},
- new Object[]{"C2042",2012,"Literature",4,2}};
-
- foreach (Object[] row in rows) {
- course.Rows.Add(row);
- }
- }
-
- // Display the results of inferring schema from four types of XML structures
- private static void InferDataSetSchemaFromXml() {
- String[] xmlFileNames = {
-
- @"ElementsWithOnlyAttributes.xml",
- @"ElementsWithAttributes.xml",
- @"RepeatingElements.xml",
- @"ElementsWithChildElements.xml" };
-
- foreach (String xmlFileName in xmlFileNames) {
- Console.WriteLine("Result of {0}", Path.GetFileNameWithoutExtension(xmlFileName));
- DataSet newSchool = new DataSet();
- newSchool.InferXmlSchema(xmlFileName, null);
- DataTableHelper.ShowDataSetSchema(newSchool);
- Console.WriteLine();
- }
- }
-}
-```
-
+using System;
+using System.Data;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+// Use WriteXml method to export the dataset.
+static class DataTableHelper {
+ public static void WriteDataSetToXML(DataSet dataset, String xmlFileName) {
+ using (FileStream fsWriterStream = new FileStream(xmlFileName, FileMode.Create)) {
+ using (XmlTextWriter xmlWriter = new XmlTextWriter(fsWriterStream, Encoding.Unicode)) {
+ dataset.WriteXml(xmlWriter, XmlWriteMode.WriteSchema);
+ Console.WriteLine("Write {0} to the File {1}.", dataset.DataSetName, xmlFileName);
+ Console.WriteLine();
+ }
+ }
+ }
+
+ // Use GetXml method to get the XML data of the dataset and then export to the file.
+ public static void GetXMLFromDataSet(DataSet dataset, String xmlFileName) {
+ using (StreamWriter writer = new StreamWriter(xmlFileName)) {
+ writer.WriteLine(dataset.GetXml());
+ Console.WriteLine("Get Xml data from {0} and write to the File {1}.", dataset.DataSetName, xmlFileName);
+ Console.WriteLine();
+ }
+ }
+
+ // Use ReadXml method to import the dataset from the dataset.
+ public static void ReadXmlIntoDataSet(DataSet newDataSet, String xmlFileName) {
+ using (FileStream fsReaderStream = new FileStream(xmlFileName, FileMode.Open)) {
+ using (XmlTextReader xmlReader = new XmlTextReader(fsReaderStream)) {
+ newDataSet.ReadXml(xmlReader, XmlReadMode.ReadSchema);
+ }
+ }
+ }
+
+ // Display the columns and value of DataSet.
+ public static void ShowDataSet(DataSet dataset) {
+ foreach (DataTable table in dataset.Tables) {
+ Console.WriteLine("Table {0}:", table.TableName);
+ ShowDataTable(table);
+ }
+ }
+
+ // Display the columns and value of DataTable.
+ private static void ShowDataTable(DataTable table) {
+ foreach (DataColumn col in table.Columns) {
+ Console.Write("{0,-14}", col.ColumnName);
+ }
+ Console.WriteLine("{0,-14}", "");
+
+ foreach (DataRow row in table.Rows) {
+ if (row.RowState == DataRowState.Deleted) {
+ foreach (DataColumn col in table.Columns) {
+ if (col.DataType.Equals(typeof(DateTime))) {
+ Console.Write("{0,-14:d}", row[col, DataRowVersion.Original]);
+ }
+ else if (col.DataType.Equals(typeof(Decimal))) {
+ Console.Write("{0,-14:C}", row[col, DataRowVersion.Original]);
+ }
+ else {
+ Console.Write("{0,-14}", row[col, DataRowVersion.Original]);
+ }
+ }
+ }
+ else {
+ foreach (DataColumn col in table.Columns) {
+ if (col.DataType.Equals(typeof(DateTime))) {
+ Console.Write("{0,-14:d}", row[col]);
+ }
+ else if (col.DataType.Equals(typeof(Decimal))) {
+ Console.Write("{0,-14:C}", row[col]);
+ }
+ else {
+ Console.Write("{0,-14}", row[col]);
+ }
+ }
+ }
+ Console.WriteLine("{0,-14}", "");
+ }
+ }
+
+ // Display the columns of DataSet.
+ public static void ShowDataSetSchema(DataSet dataSet) {
+ Console.WriteLine("{0} contains the following tables:", dataSet.DataSetName);
+ foreach (DataTable table in dataSet.Tables) {
+ Console.WriteLine(" Table {0} contains the following columns:", table.TableName);
+ ShowDataTableSchema(table);
+ }
+ }
+
+ // Display the columns of DataTable
+ private static void ShowDataTableSchema(DataTable table) {
+ String columnString = "";
+ foreach (DataColumn col in table.Columns) {
+ columnString += col.ColumnName + " ";
+ }
+ Console.WriteLine(columnString);
+ }
+}
+
+class Program {
+ static void Main(string[] args) {
+ // Create the DataSet
+ DataSet school = new DataSet("MySchool");
+ DataTable course = CreateCourse();
+ DataTable department = CreateDepartment();
+ school.Tables.Add(course);
+ school.Tables.Add(department);
+
+ // Define the constraint between the tables.
+ ForeignKeyConstraint courseDepartFK = new ForeignKeyConstraint("CourseDepartFK", department.Columns["DepartmentID"], course.Columns["DepartmentID"]);
+ courseDepartFK.DeleteRule = Rule.Cascade;
+ courseDepartFK.UpdateRule = Rule.Cascade;
+ courseDepartFK.AcceptRejectRule = AcceptRejectRule.None;
+ course.Constraints.Add(courseDepartFK);
+
+ InsertDepartments(department);
+ InsertCourses(course);
+
+ // Export the dataset to the XML file.
+ Console.WriteLine("Data of the whole DataSet {0}", school.DataSetName);
+ DataTableHelper.ShowDataSet(school);
+
+ String xmlWithSchemaFileName = "WriterXMLWithSchema.xml";
+ String xmlGetDataFileName = "GetXML.xml";
+
+ // Use two ways to export the dataset to the Xml file.
+ DataTableHelper.WriteDataSetToXML(school, xmlWithSchemaFileName);
+ DataTableHelper.GetXMLFromDataSet(school, xmlGetDataFileName);
+
+ // Import the dataset from the XML file.
+ // Use two ways to import the dataset from the Xml file.
+ Console.WriteLine("Read Xml document into a new DataSet:");
+ DataSet newSchool = new DataSet("NewSchool");
+ DataTableHelper.ReadXmlIntoDataSet(newSchool, xmlWithSchemaFileName);
+ DataTableHelper.ShowDataSetSchema(newSchool);
+ Console.WriteLine();
+
+ Console.WriteLine("Infer a schema for a DataSet from an XML document:");
+ InferDataSetSchemaFromXml();
+
+ Console.WriteLine("Press any key to exit.");
+ Console.ReadKey();
+ }
+
+ static DataTable CreateCourse() {
+ DataTable course = new DataTable("Course");
+ DataColumn[] cols ={
+ new DataColumn("CourseID",typeof(String)),
+ new DataColumn("Year",typeof(Int32)),
+ new DataColumn("Title",typeof(String)),
+ new DataColumn("Credits",typeof(Int32)),
+ new DataColumn("DepartmentID",typeof(Int32))};
+ course.Columns.AddRange(cols);
+
+ course.PrimaryKey = new DataColumn[] { course.Columns["CourseID"], course.Columns["Year"] };
+
+ return course;
+ }
+
+ static DataTable CreateDepartment() {
+ DataTable department = new DataTable("Department");
+ DataColumn[] cols = {
+ new DataColumn("DepartmentID", typeof(Int32)),
+ new DataColumn("Name",typeof(String)),
+ new DataColumn("Budget",typeof(Decimal)),
+ new DataColumn("StartDate",typeof(DateTime)),
+ new DataColumn("Administrator",typeof(Int32))};
+ department.Columns.AddRange(cols);
+
+ department.PrimaryKey = new DataColumn[] { department.Columns["DepartmentID"] };
+
+ return department;
+ }
+
+ static void InsertDepartments(DataTable department) {
+ Object[] rows = {
+ new Object[]{1,"Engineering",350000.00,new DateTime(2007,9,1),2},
+ new Object[]{2,"English",120000.00,new DateTime(2007,9,1),6},
+ new Object[]{4,"Economics",200000.00,new DateTime(2007,9,1),4},
+ new Object[]{7,"Mathematics",250024.00,new DateTime(2007,9,1),3}};
+
+ foreach (Object[] row in rows) {
+ department.Rows.Add(row);
+ }
+ }
+
+ static void InsertCourses(DataTable course) {
+ Object[] rows ={
+ new Object[]{"C1045",2012,"Calculus",4,7},
+ new Object[]{"C1061",2012,"Physics",4,1},
+ new Object[]{"C2021",2012,"Composition",3,2},
+ new Object[]{"C2042",2012,"Literature",4,2}};
+
+ foreach (Object[] row in rows) {
+ course.Rows.Add(row);
+ }
+ }
+
+ // Display the results of inferring schema from four types of XML structures
+ private static void InferDataSetSchemaFromXml() {
+ String[] xmlFileNames = {
+
+ @"ElementsWithOnlyAttributes.xml",
+ @"ElementsWithAttributes.xml",
+ @"RepeatingElements.xml",
+ @"ElementsWithChildElements.xml" };
+
+ foreach (String xmlFileName in xmlFileNames) {
+ Console.WriteLine("Result of {0}", Path.GetFileNameWithoutExtension(xmlFileName));
+ DataSet newSchool = new DataSet();
+ newSchool.InferXmlSchema(xmlFileName, null);
+ DataTableHelper.ShowDataSetSchema(newSchool);
+ Console.WriteLine();
+ }
+ }
+}
+```
+
]]>
Using DataSets in ADO.NET
@@ -2156,23 +2123,23 @@ class Program {
Returns the XML Schema for the XML representation of the data stored in the .
String that is the XML Schema for the XML representation of the data stored in the .
- , except that only the primary schema is written.
-
- returns XML as a string, and therefore requires more overhead than to write XML to a file.
-
- If you build a using schema inference and serialize it using XML or Web services, the column ordering may change.
-
-
-
-## Examples
- The following example creates a and , and then displays the schema in XML format.
-
+ , except that only the primary schema is written.
+
+ returns XML as a string, and therefore requires more overhead than to write XML to a file.
+
+ If you build a using schema inference and serialize it using XML or Web services, the column ordering may change.
+
+
+
+## Examples
+ The following example creates a and , and then displays the schema in XML format.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.GetXmlSchema Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetXmlSchema Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetXmlSchema Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -2228,14 +2195,14 @@ class Program {
if the has changes; otherwise, .
- method to create a second object that is then used to update a data source.
-
+ method to create a second object that is then used to update a data source.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.HasChanges Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.HasChanges Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.HasChanges Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -2283,19 +2250,19 @@ class Program {
if the has changes; otherwise, .
- property of the `DataSet` before invoking the method.
-
-
-
-## Examples
- The following example uses the method to create a second object, which is then used to update a data source.
-
+ property of the `DataSet` before invoking the method.
+
+
+
+## Examples
+ The following example uses the method to create a second object, which is then used to update a data source.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges1 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges1 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges1 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -2349,19 +2316,19 @@ class Program {
if any table contains an error; otherwise, .
- in a also has a property. Use the `HasErrors` property of the `DataSet` first, to determine if any table has errors, before checking individual objects. If a `DataTable` has errors, the method returns an array of objects containing the errors.
-
-
-
-## Examples
- The following example uses the property to determine whether a object contains errors. If so, the errors for each in each are printed.
-
+ in a also has a property. Use the `HasErrors` property of the `DataSet` first, to determine if any table has errors, before checking individual objects. If a `DataTable` has errors, the method returns an array of objects containing the errors.
+
+
+
+## Examples
+ The following example uses the property to determine whether a object contains errors. If so, the errors for each in each are printed.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.HasErrors Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.HasErrors Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.HasErrors Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -2681,11 +2648,11 @@ class Program {
Occurs after the is initialized.
- .
-
+ .
+
]]>
Using DataSets in ADO.NET
@@ -2772,11 +2739,11 @@ class Program {
if the specified represents a serialized in its binary format, otherwise.
-
@@ -2827,12 +2794,12 @@ class Program {
to indicate the component has completed initialization; otherwise, .
- while it's being constructed, for instance by Visual Studio. The method sets it to `false` and method sets it to `true`.
-
- ]]>
+ while it's being constructed, for instance by Visual Studio. The method sets it to `false` and method sets it to `true`.
+
+ ]]>
Using DataSets in ADO.NET
@@ -2846,35 +2813,35 @@ class Program {
Fills a with values from a data source using the supplied .
- method provides a technique for filling a single with data, retrieved from an instance. This method provides the same functionality, but allows you to load multiple result sets from an `IDataReader` into multiple tables within a `DataSet`.
-
- If the `DataSet` already contains rows, the incoming data from the data source is merged with the existing rows.
-
- The `Load` method can be used in several common scenarios, all centered around getting data from a specified data source and adding it to the current data container (in this case, a `DataSet`). These scenarios describe standard usage for a `DataSet`, describing its update and merge behavior.
-
- A `DataSet` synchronizes or updates with a single primary data source. The `DataSet` tracks changes, allowing synchronization with the primary data source. In addition, a `DataSet` can accept incremental data from one or more secondary data sources. The `DataSet` isn't responsible for tracking changes in order to allow synchronization with the secondary data source.
-
- Given these two hypothetical data sources, a user is likely to require one of the following behaviors:
-
-- Initialize `DataSet` from a primary data source. In this scenario, the user wants to initialize an empty `DataSet` with values from the primary data source. One or more DataTable's contents are modified. Later the user intends to propagate changes back to the primary data source.
-
-- Preserve changes and re-synchronize from the primary data source. In this scenario, the user wants to take the `DataSet` filled in the previous scenario and perform an incremental synchronization with the primary data source, preserving modifications made in the `DataSet`.
-
-- Incremental data feed from secondary data sources. In this scenario, the user wants to merge changes from one or more secondary data sources, and propagate those changes back to the primary data source.
-
- The `Load` method makes all these scenarios possible. This method allows you to specify a load option parameter, indicating how rows already in a combine with rows being loaded. The following table describes the three load options provided by the enumeration. In each case, the description indicates the behavior when the primary key of a row in the incoming data matches the primary key of an existing row.
-
-|Load Option|Description|
-|-----------------|-----------------|
-|`PreserveChanges` (default)|Updates the original version of the row with the value of the incoming row.|
-|`OverwriteChanges`|Updates the current and original versions of the row with the value of the incoming row.|
-|`Upsert`|Updates the current version of the row with the value of the incoming row.|
-
- In general, the `PreserveChanges` and `OverwriteChanges` options are intended for scenarios in which the user needs to synchronize the `DataSet` and its changes with the primary data source. The `Upsert` option facilitates aggregating changes from one or more secondary data sources.
-
+ method provides a technique for filling a single with data, retrieved from an instance. This method provides the same functionality, but allows you to load multiple result sets from an `IDataReader` into multiple tables within a `DataSet`.
+
+ If the `DataSet` already contains rows, the incoming data from the data source is merged with the existing rows.
+
+ The `Load` method can be used in several common scenarios, all centered around getting data from a specified data source and adding it to the current data container (in this case, a `DataSet`). These scenarios describe standard usage for a `DataSet`, describing its update and merge behavior.
+
+ A `DataSet` synchronizes or updates with a single primary data source. The `DataSet` tracks changes, allowing synchronization with the primary data source. In addition, a `DataSet` can accept incremental data from one or more secondary data sources. The `DataSet` isn't responsible for tracking changes in order to allow synchronization with the secondary data source.
+
+ Given these two hypothetical data sources, a user is likely to require one of the following behaviors:
+
+- Initialize `DataSet` from a primary data source. In this scenario, the user wants to initialize an empty `DataSet` with values from the primary data source. One or more DataTable's contents are modified. Later the user intends to propagate changes back to the primary data source.
+
+- Preserve changes and re-synchronize from the primary data source. In this scenario, the user wants to take the `DataSet` filled in the previous scenario and perform an incremental synchronization with the primary data source, preserving modifications made in the `DataSet`.
+
+- Incremental data feed from secondary data sources. In this scenario, the user wants to merge changes from one or more secondary data sources, and propagate those changes back to the primary data source.
+
+ The `Load` method makes all these scenarios possible. This method allows you to specify a load option parameter, indicating how rows already in a combine with rows being loaded. The following table describes the three load options provided by the enumeration. In each case, the description indicates the behavior when the primary key of a row in the incoming data matches the primary key of an existing row.
+
+|Load Option|Description|
+|-----------------|-----------------|
+|`PreserveChanges` (default)|Updates the original version of the row with the value of the incoming row.|
+|`OverwriteChanges`|Updates the current and original versions of the row with the value of the incoming row.|
+|`Upsert`|Updates the current version of the row with the value of the incoming row.|
+
+ In general, the `PreserveChanges` and `OverwriteChanges` options are intended for scenarios in which the user needs to synchronize the `DataSet` and its changes with the primary data source. The `Upsert` option facilitates aggregating changes from one or more secondary data sources.
+
]]>
Using DataSets in ADO.NET
@@ -2936,28 +2903,28 @@ class Program {
An array of instances, from which the method retrieves name and namespace information. Each of these tables must be a member of the contained by this .
Fills a with values from a data source using the supplied , using an array of instances to supply the schema and namespace information.
- method provides a technique for filling a single with data, retrieved from an instance. This method provides the same functionality, but allows you to load multiple result sets from an into multiple tables within a .
-
+ method provides a technique for filling a single with data, retrieved from an instance. This method provides the same functionality, but allows you to load multiple result sets from an into multiple tables within a .
+
> [!NOTE]
-> The load operation will fail with an if any of the source data columns in the incoming `reader` are computed columns.
-
- The `loadOption` parameter allows you to specify how you want the imported data to interact with existing data, and can be any of the values from the enumeration. See the documentation for the method for more information on using this parameter.
-
- The `tables` parameter allows you to specify an array of instances, indicating the order of the tables corresponding to each result set loaded from the reader. The method fills each supplied instance with data from a single result set from the source data reader. After each result set, the method moves on to the next result set within the reader, until there are no more result sets.
-
- The name resolution scheme for this method is the same as that followed by the method of the class.
-
-
-
-## Examples
- The following example creates a new , adds two instances to the , and then fills the using the method, retrieving data from a that contains two result sets. Finally, the example displays the contents of the tables in the console window.
-
+> The load operation will fail with an if any of the source data columns in the incoming `reader` are computed columns.
+
+ The `loadOption` parameter allows you to specify how you want the imported data to interact with existing data, and can be any of the values from the enumeration. See the documentation for the method for more information on using this parameter.
+
+ The `tables` parameter allows you to specify an array of instances, indicating the order of the tables corresponding to each result set loaded from the reader. The method fills each supplied instance with data from a single result set from the source data reader. After each result set, the method moves on to the next result set within the reader, until there are no more result sets.
+
+ The name resolution scheme for this method is the same as that followed by the method of the class.
+
+
+
+## Examples
+ The following example creates a new , adds two instances to the , and then fills the using the method, retrieving data from a that contains two result sets. Finally, the example displays the contents of the tables in the console window.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.LoadTables/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.LoadTables/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.LoadTables/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -3019,28 +2986,28 @@ class Program {
An array of strings, from which the method retrieves table name information.
Fills a with values from a data source using the supplied , using an array of strings to supply the names for the tables within the .
- method provides a technique for filling a single with data, retrieved from an instance. This method provides the same functionality, but allows you to load multiple result sets from an `IDataReader` into multiple tables within a `DataSet`.
-
+ method provides a technique for filling a single with data, retrieved from an instance. This method provides the same functionality, but allows you to load multiple result sets from an `IDataReader` into multiple tables within a `DataSet`.
+
> [!NOTE]
-> The load operation will fail with an if any of the source data columns in the incoming `reader` are computed columns.
-
- The `loadOption` parameter allows you to specify how you want the imported data to interact with existing data, and can be any of the values from the enumeration. See the documentation for the method for more information on using this parameter.
-
- The `tables` parameter allows you to specify an array of table names, indicating the order of the tables corresponding to each result set loaded from the reader. The `Load` method attempts to find a table within the `DataSet` matching the name found in the array of table names, in order. If a matching table is found, that table is loaded with the content of the current result set. If no matching table is found, a table is created using the name supplied in the array of table names, and the new table's schema is inferred from the result set. After each result set, the `Load` method moves on to the next result set within the reader, until there are no more result sets.
-
- The default namespace associated with `DataSet`, if any, is associated with each newly created `DataTable`. The name resolution scheme for this method is the same as that followed by the method of the class.
-
-
-
-## Examples
- The following Console application example first creates tables and loads data from a reader into a , using the `Load` method. The example then adds tables to a and attempts to fill the tables with data from a . In this example, because the parameters passed to the `Load` method indicate a table name that does not exist, the `Load` method creates a new table to match the name passed as a parameter. Once the data has been loaded, the example displays the contents of all its tables in the Console window.
-
+> The load operation will fail with an if any of the source data columns in the incoming `reader` are computed columns.
+
+ The `loadOption` parameter allows you to specify how you want the imported data to interact with existing data, and can be any of the values from the enumeration. See the documentation for the method for more information on using this parameter.
+
+ The `tables` parameter allows you to specify an array of table names, indicating the order of the tables corresponding to each result set loaded from the reader. The `Load` method attempts to find a table within the `DataSet` matching the name found in the array of table names, in order. If a matching table is found, that table is loaded with the content of the current result set. If no matching table is found, a table is created using the name supplied in the array of table names, and the new table's schema is inferred from the result set. After each result set, the `Load` method moves on to the next result set within the reader, until there are no more result sets.
+
+ The default namespace associated with `DataSet`, if any, is associated with each newly created `DataTable`. The name resolution scheme for this method is the same as that followed by the method of the class.
+
+
+
+## Examples
+ The following Console application example first creates tables and loads data from a reader into a , using the `Load` method. The example then adds tables to a and attempts to fill the tables with data from a . In this example, because the parameters passed to the `Load` method indicate a table name that does not exist, the `Load` method creates a new table to match the name passed as a parameter. Once the data has been loaded, the example displays the contents of all its tables in the Console window.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.LoadString/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.LoadString/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.LoadString/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -3112,30 +3079,30 @@ class Program {
An array of instances, from which the method retrieves name and namespace information.
Fills a with values from a data source using the supplied , using an array of instances to supply the schema and namespace information.
- method provides a technique for filling a single with data, retrieved from an instance. This method provides the same functionality, but allows you to load multiple result sets from an into multiple tables within a .
-
+ method provides a technique for filling a single with data, retrieved from an instance. This method provides the same functionality, but allows you to load multiple result sets from an into multiple tables within a .
+
> [!NOTE]
-> The load operation will fail with an if any of the source data columns in the incoming `reader` are computed columns.
-
- The `loadOption` parameter allows you to specify how you want the imported data to interact with existing data, and can be any of the values from the enumeration. See the documentation for the method for more information on using this parameter.
-
- The `errorHandler` parameter is a delegate that refers to a procedure that is called when an error occurs while loading data. The parameter passed to the procedure provides properties that allow you to retrieve information about the error that occurred, the current row of data, and the being filled. Using this delegate mechanism, rather than a simpler try/catch block, allows you to determine the error, handle the situation, and continue processing if you like. The parameter supplies a property: set this property to `true` to indicate that you have handled the error and wish to continue processing; set the property to `false` to indicate that you wish to halt processing. Be aware that setting the property to `false` causes the code that triggered the problem to throw an exception.
-
- The `tables` parameter allows you to specify an array of instances, indicating the order of the tables corresponding to each result set loaded from the reader. The method fills each supplied instance with data from a single result set from the source data reader. After each result set, the method moves on to the next result set within the reader, until there are no more result sets.
-
- The name resolution scheme for this method is the same as that followed by the method of the class.
-
-
-
-## Examples
- The following example adds a table to a , and then attempts to use the method to load data from a that contains an incompatible schema. Rather than trapping the error, this example uses a delegate to investigate and handle the error. The output is displayed in the console window.
-
+> The load operation will fail with an if any of the source data columns in the incoming `reader` are computed columns.
+
+ The `loadOption` parameter allows you to specify how you want the imported data to interact with existing data, and can be any of the values from the enumeration. See the documentation for the method for more information on using this parameter.
+
+ The `errorHandler` parameter is a delegate that refers to a procedure that is called when an error occurs while loading data. The parameter passed to the procedure provides properties that allow you to retrieve information about the error that occurred, the current row of data, and the being filled. Using this delegate mechanism, rather than a simpler try/catch block, allows you to determine the error, handle the situation, and continue processing if you like. The parameter supplies a property: set this property to `true` to indicate that you have handled the error and wish to continue processing; set the property to `false` to indicate that you wish to halt processing. Be aware that setting the property to `false` causes the code that triggered the problem to throw an exception.
+
+ The `tables` parameter allows you to specify an array of instances, indicating the order of the tables corresponding to each result set loaded from the reader. The method fills each supplied instance with data from a single result set from the source data reader. After each result set, the method moves on to the next result set within the reader, until there are no more result sets.
+
+ The name resolution scheme for this method is the same as that followed by the method of the class.
+
+
+
+## Examples
+ The following example adds a table to a , and then attempts to use the method to load data from a that contains an incompatible schema. Rather than trapping the error, this example uses a delegate to investigate and handle the error. The output is displayed in the console window.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataSet.Load/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.Load/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataSet.Load/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -3184,23 +3151,23 @@ class Program {
Gets or sets the locale information used to compare strings within the table.
A that contains data about the user's machine locale. The default is .
- property specifies the locale for which sorting applies.
-
- By default, setting the for a also sets the for each object in that `DataSet` to the same value.
-
+ property specifies the locale for which sorting applies.
+
+ By default, setting the for a also sets the for each object in that `DataSet` to the same value.
+
> [!NOTE]
-> In columns that contain expressions, the is used. The is ignored.
-
-
-
-## Examples
- The following example gets the for a and prints the and properties.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Locale Example/VB/source.vb" id="Snippet1":::
-
+> In columns that contain expressions, the is used. The is ignored.
+
+
+
+## Examples
+ The following example gets the for a and prints the and properties.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Locale Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -3257,23 +3224,23 @@ class Program {
The array of objects to be merged into the .
Merges an array of objects into the current .
- method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
-
- The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
-
- In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
-
- When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
-
- After merging schemas, the data is merged.
-
- When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a value of `Added` are matched to new target rows with the same primary key values as the new source rows.
-
- During a merge, constraints are disabled. If any constraints cannot be enabled at the end of a merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
-
+ method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
+
+ The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
+
+ In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
+
+ When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
+
+ After merging schemas, the data is merged.
+
+ When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a value of `Added` are matched to new target rows with the same primary key values as the new source rows.
+
+ During a merge, constraints are disabled. If any constraints cannot be enabled at the end of a merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
+
]]>
Using DataSets in ADO.NET
@@ -3319,31 +3286,31 @@ class Program {
The whose data and schema will be merged.
Merges a specified and its schema into the current .
- method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
-
- The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
-
- In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
-
- When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
-
- After merging schemas, the data is merged.
-
- When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
-
- During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
-
-
-
-## Examples
- The following example uses the , Update, and methods on a .
-
+ method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
+
+ The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
+
+ In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
+
+ When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
+
+ After merging schemas, the data is merged.
+
+ When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
+
+ During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
+
+
+
+## Examples
+ The following example uses the , Update, and methods on a .
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge Example/VB/source.vb" id="Snippet1":::
+
]]>
One or more constraints cannot be enabled.
@@ -3394,31 +3361,31 @@ class Program {
The whose data and schema will be merged.
Merges a specified and its schema into the current .
- method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
-
- The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
-
- In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
-
- When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
-
- After merging schemas, the data is merged.
-
- When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
-
- During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
-
-
-
-## Examples
- The following example creates a simple with one table, two columns, and ten rows. A second is created that is identical to the first. Two rows are added to the second table, which is then merged into the .
-
+ method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
+
+ The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
+
+ In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
+
+ When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
+
+ After merging schemas, the data is merged.
+
+ When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
+
+ During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
+
+
+
+## Examples
+ The following example creates a simple with one table, two columns, and ten rows. A second is created that is identical to the first. Two rows are added to the second table, which is then merged into the .
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge3 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge3 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge3 Example/VB/source.vb" id="Snippet1":::
+
]]>
The is .
@@ -3468,31 +3435,31 @@ class Program {
to preserve changes in the current ; otherwise, .
Merges a specified and its schema into the current , preserving or discarding any changes in this according to the given argument.
- method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
-
- The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
-
- In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
-
- When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
-
- After merging schemas, the data is merged.
-
- When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
-
- During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
-
-
-
-## Examples
- The following example creates a simple with one table, two columns, and ten rows. After adding ten rows, two values are changed, and one row is added. A subset of the changed data is created using the method. After reconciling errors, the subset data is merged into the original .
-
+ method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
+
+ The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
+
+ In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
+
+ When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
+
+ After merging schemas, the data is merged.
+
+ When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
+
+ During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
+
+
+
+## Examples
+ The following example creates a simple with one table, two columns, and ten rows. After adding ten rows, two values are changed, and one row is added. A subset of the changed data is created using the method. After reconciling errors, the subset data is merged into the original .
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -3545,25 +3512,25 @@ class Program {
One of the values.
Merges an array of objects into the current , preserving or discarding changes in the and handling an incompatible schema according to the given arguments.
- method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
-
- The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
-
- In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
-
- To facilitate explanation of the method, we use "target" to signify the current , and "source" to name the second (parameter) . The target is so named because it is the object upon which an action (the merge) occurs. The second is called a "source" because the information it contains does not change, but instead is merged into the current .
-
- When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
-
- After merging schemas, the data is merged.
-
- When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
-
- During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
-
+ method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
+
+ The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
+
+ In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
+
+ To facilitate explanation of the method, we use "target" to signify the current , and "source" to name the second (parameter) . The target is so named because it is the object upon which an action (the merge) occurs. The second is called a "source" because the information it contains does not change, but instead is merged into the current .
+
+ When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
+
+ After merging schemas, the data is merged.
+
+ When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
+
+ During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
+
]]>
Using DataSets in ADO.NET
@@ -3614,33 +3581,33 @@ class Program {
One of the values.
Merges a specified and its schema with the current , preserving or discarding changes in the current and handling an incompatible schema according to the given arguments.
- method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
-
- The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
-
- In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
-
- To facilitate explanation of the method, we use "target" to signify the current , and "source" to name the second (parameter) . The target is so named because it is the object upon which an action (the merge) occurs. The second is called a "source" because the information it contains does not change, but instead is merged into the current .
-
- When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
-
- After merging schemas, the data is merged.
-
- When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
-
- During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
-
-
-
-## Examples
- The following example creates a simple with one table, two columns, and ten rows. Two values are changed, and one row is added. A subset of the changed data is created using the method. After reconciling errors, a new column is added to the subset, changing the schema. When the method is called with the `missingSchemaAction` set to `MissingSchemaAction.Add`, the new column is added to the original object's schema.
-
+ method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
+
+ The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
+
+ In a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
+
+ To facilitate explanation of the method, we use "target" to signify the current , and "source" to name the second (parameter) . The target is so named because it is the object upon which an action (the merge) occurs. The second is called a "source" because the information it contains does not change, but instead is merged into the current .
+
+ When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
+
+ After merging schemas, the data is merged.
+
+ When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
+
+ During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
+
+
+
+## Examples
+ The following example creates a simple with one table, two columns, and ten rows. Two values are changed, and one row is added. A subset of the changed data is created using the method. After reconciling errors, a new column is added to the subset, changing the schema. When the method is called with the `missingSchemaAction` set to `MissingSchemaAction.Add`, the new column is added to the original object's schema.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge2 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge2 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge2 Example/VB/source.vb" id="Snippet1":::
+
]]>
The is .
@@ -3692,31 +3659,31 @@ class Program {
to preserve changes in the ; otherwise, .
Merges a specified and its schema into the current , preserving or discarding changes in the and handling an incompatible schema according to the given arguments.
- method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
-
- The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
-
- iOn a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
-
- When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
-
- After merging schemas, the data is merged.
-
- When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
-
- During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
-
-
-
-## Examples
- The following example creates a simple with one table, two columns, and ten rows. A second is created that is nearly identical to the first except that a new `DataColumn` is added to the table. Two rows are added to the second table, which is then merged into the with the `preserveChanges` argument set to `false`, and the `missingSchemaAction` argument set to `MissingSchemaAction.Add`.
-
+ method is used to merge two objects that have largely similar schemas. A merge is typically used on a client application to incorporate the latest changes from a data source into an existing . This allows the client application to have a refreshed with the latest data from the data source.
+
+ The method is typically called at the end of a series of procedures that involve validating changes, reconciling errors, updating the data source with the changes, and finally refreshing the existing .
+
+ iOn a client application, it is common to have a single button that the user can click that gathers the changed data and validates it before sending it back to a middle-tier component. In this scenario, the method is first invoked. That method returns a second optimized for validating and merging. This second object contains only the and objects that were changed, resulting in a subset of the original . This subset is generally smaller, and thus more efficiently passed back to a middle-tier component. The middle-tier component then updates the original data source with the changes through stored procedures. The middle tier can then send back either a new that includes original data and the latest data from the data source (by running the original query again), or it can send back the subset with any changes that have been made to it from the data source. (For example, if the data source automatically creates unique primary key values, these values can be propagated back to the client application.) In either case, the returned can be merged back into the client application's original with the method.
+
+ When the method is called, the schemas of the two objects are compared because it is possible that the schemas may have been changed. For example, in a business-to-business scenario, new columns may have been added to an XML schema by an automated process. If the source contains schema elements (added objects) that are missing in the target, the schema elements can be added to the target by setting the `missingSchemaAction` argument to `MissingSchemaAction.Add`. In that case, the merged contains the added schema and data.
+
+ After merging schemas, the data is merged.
+
+ When merging a new source into the target, any source rows with a value of `Unchanged`, `Modified`, or `Deleted` are matched to target rows with the same primary key values. Source rows with a `DataRowState` value of `Added` are matched to new target rows with the same primary key values as the new source rows.
+
+ During a merge, constraints are disabled. If any constraints cannot be enabled at the end of merge, a is generated and the merged data is retained while the constraints are disabled. In this case, the property is set to `false`, and all rows that are invalid are marked in error. The errors must be resolved before attempting to reset the property to `true`.
+
+
+
+## Examples
+ The following example creates a simple with one table, two columns, and ten rows. A second is created that is nearly identical to the first except that a new `DataColumn` is added to the table. Two rows are added to the second table, which is then merged into the with the `preserveChanges` argument set to `false`, and the `missingSchemaAction` argument set to `MissingSchemaAction.Add`.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge4 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge4 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge4 Example/VB/source.vb" id="Snippet1":::
+
]]>
The is .
@@ -3778,19 +3745,19 @@ class Program {
Occurs when a target and source have the same primary key value, and is set to true.
- event.
-
+ event.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.MergeFailed Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.MergeFailed Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.MergeFailed Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -3843,21 +3810,21 @@ class Program {
Gets or sets the namespace of the .
The namespace of the .
- property is used when reading and writing an XML document into the using the , , , or methods.
-
- The namespace of an XML document is used to scope XML attributes and elements when read into a . For example, if a contains a schema that was read from a document with the namespace "myCompany," and an attempt is made to read data only from a document with a different namespace, any data that does not correspond to the existing schema is ignored.
-
-
-
-## Examples
- The following example sets the before calling the method.
-
+ property is used when reading and writing an XML document into the using the , , , or methods.
+
+ The namespace of an XML document is used to scope XML attributes and elements when read into a . For example, if a contains a schema that was read from a document with the namespace "myCompany," and an attempt is made to read data only from a document with a different namespace, any data that does not correspond to the existing schema is ignored.
+
+
+
+## Examples
+ The following example sets the before calling the method.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Namespace Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Namespace Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Namespace Example/VB/source.vb" id="Snippet1":::
+
]]>
The namespace already has data.
@@ -3908,11 +3875,11 @@ class Program {
A that contains the event data.
Raises the event.
-
@@ -3961,11 +3928,11 @@ class Program {
The being removed.
Occurs when a object is removed from a .
-
Using DataSets in ADO.NET
@@ -4015,19 +3982,19 @@ class Program {
The being removed.
Occurs when a is removed from a .
- with the method overridden.
-
+ with the method overridden.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.OnRemoveTable Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.OnRemoveTable Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.OnRemoveTable Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -4080,19 +4047,19 @@ class Program {
Gets or sets an XML prefix that aliases the namespace of the .
The XML prefix for the namespace.
- property is used throughout an XML document to identify elements which belong to the namespace of the object (as set by the property).
-
-
-
-## Examples
- The following example sets the before calling the method.
-
+ property is used throughout an XML document to identify elements which belong to the namespace of the object (as set by the property).
+
+
+
+## Examples
+ The following example sets the before calling the method.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Namespace Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Namespace Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Namespace Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -4204,46 +4171,46 @@ class Program {
Reads XML schema and data into the using the specified .
The used to read the data.
- method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
-
- Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
-
+ method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
+
+ Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
- If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
-
- If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+ If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
+
+ If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
+
> [!NOTE]
-> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
-
- If the XML Schema for a includes `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema, as the following example demonstrates.
-
-```
-
-
-```
-
+> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
+
+ If the XML Schema for a includes `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema, as the following example demonstrates.
+
+```
+
+
+```
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
-
-
-
-## Examples
- The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
+
+
+
+## Examples
+ The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml1 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml1 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml1 Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -4304,48 +4271,48 @@ class Program {
Reads XML schema and data into the using the specified .
The used to read the data.
- method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
-
- Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
-
+ method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
+
+ Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
- If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
-
- If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+ If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
+
+ If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
+
> [!NOTE]
-> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
-
- If the XML Schema for a includes `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
-
-```
-
-
-```
-
- Classes that inherit from the class include the and classes.
-
+> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
+
+ If the XML Schema for a includes `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
+
+```
+
+
+```
+
+ Classes that inherit from the class include the and classes.
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
-
-
-
-## Examples
- The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
+
+
+
+## Examples
+ The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml2 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml2 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml2 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -4398,46 +4365,46 @@ class Program {
Reads XML schema and data into the using the specified file.
The used to read the data.
- method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
-
- Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
-
+ method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
+
+ Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
- If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
-
- If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+ If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
+
+ If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
+
> [!NOTE]
-> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
-
- If the XML Schema for a includes a `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
-
-```
-
-
-```
-
+> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
+
+ If the XML Schema for a includes a `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
+
+```
+
+
+```
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
-
-
-
-## Examples
- The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
+
+
+
+## Examples
+ The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml3 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml3 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml3 Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -4497,48 +4464,48 @@ class Program {
Reads XML schema and data into the using the specified .
The used to read the data.
- method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
-
- Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
-
+ method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
+
+ Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
- If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
-
- If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+ If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
+
+ If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
+
> [!NOTE]
-> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
-
- If the XML Schema for a includes a `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
-
-```
-
-
-```
-
- inherits from .
-
+> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
+
+ If the XML Schema for a includes a `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
+
+```
+
+
+```
+
+ inherits from .
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
-
-
-
-## Examples
- The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
+
+
+
+## Examples
+ The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -4598,41 +4565,41 @@ class Program {
Reads XML schema and data into the using the specified and .
The used to read the data.
- method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
-
- The same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
-
+ method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
+
+ The same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
+
> [!NOTE]
-> When you use and you set to `Diffgram`, the content of the target `DataSet` and the original `DataSet` may differ because of how the diffgram is generated and processed. For more information on diffgrams, see [DiffGrams](/dotnet/framework/data/adonet/dataset-datatable-dataview/diffgrams).
-
+> When you use and you set to `Diffgram`, the content of the target `DataSet` and the original `DataSet` may differ because of how the diffgram is generated and processed. For more information on diffgrams, see [DiffGrams](/dotnet/framework/data/adonet/dataset-datatable-dataview/diffgrams).
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
- If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
-
- If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+ If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
+
+ If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
+
> [!NOTE]
-> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
-
- If the XML Schema for a includes `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
-
-```
-
-
-```
-
+> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
+
+ If the XML Schema for a includes `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
+
+```
+
+
+```
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
+
]]>
Using DataSets in ADO.NET
@@ -4692,38 +4659,38 @@ class Program {
Reads XML schema and data into the using the specified and .
The used to read the data.
- method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
-
- Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
-
+ method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
+
+ Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
- If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
-
- If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+ If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
+
+ If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
+
> [!NOTE]
-> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
-
- If the XML Schema for a includes `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
-
-```
-
-
-```
-
+> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
+
+ If the XML Schema for a includes `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
+
+```
+
+
+```
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
+
]]>
Using DataSets in ADO.NET
@@ -4778,38 +4745,38 @@ class Program {
Reads XML schema and data into the using the specified file and .
The used to read the data.
- method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
-
- Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
-
+ method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
+
+ Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
- If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
-
- If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+ If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
+
+ If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
+
> [!NOTE]
-> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
-
- If the XML Schema for a includes a `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
-
-```
-
-
-```
-
+> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
+
+ If the XML Schema for a includes a `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
+
+```
+
+
+```
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
+
]]>
@@ -4871,38 +4838,38 @@ class Program {
Reads XML schema and data into the using the specified and .
The used to read the data.
- method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
-
- Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
-
+ method provides a way to read either data only, or both data and schema into a from an XML document, whereas the method reads only the schema. To read both data and schema, use one of the `ReadXML` overloads that includes the `mode` parameter, and set its value to `ReadSchema`.
+
+ Note that the same is true for the and methods, respectively. To write XML data, or both schema and data from the `DataSet`, use the `WriteXml` method. To write just the schema, use the `WriteXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
- If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
-
- If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+ If an in-line schema is specified, the in-line schema is used to extend the existing relational structure prior to loading the data. If there are any conflicts (for example, the same column in the same table defined with different data types) an exception is raised.
+
+ If no in-line schema is specified, the relational structure is extended through inference, as necessary, according to the structure of the XML document. If the schema cannot be extended through inference in order to expose all data, an exception is raised.
+
> [!NOTE]
-> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
-
- If the XML Schema for a includes a `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
-
-```
-
-
-```
-
+> The `DataSet` does not associate an XML element with its corresponding `DataColumn` or `DataTable` when legal XML characters like ("_") are escaped in the serialized XML. The `DataSet` itself only escapes illegal XML characters in XML element names and hence can only consume the same. When legal characters in XML element name are escaped, the element is ignored while processing.
+
+ If the XML Schema for a includes a `targetNamespace`, data may not be read, and you may encounter exceptions when calling to load the with XML that contains elements with no qualifying namespace. To read unqualified elements, set `elementFormDefault` equal to "qualified" in your XML Schema as the following example demonstrates.
+
+```
+
+
+```
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with by specifying `XmlReadMode.ReadSchema`. This exception does not occur if you are using .NET Framework version 1.0.
+
]]>
Using DataSets in ADO.NET
@@ -4970,31 +4937,31 @@ class Program {
The from which to read.
Reads the XML schema from the specified into the .
- method to create the schema for a . The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
-
- The XML schema is written using the XSD standard.
-
+ method to create the schema for a . The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
+
+ The XML schema is written using the XSD standard.
+
> [!NOTE]
-> Data corruption can occur if the msdata:DataType and the xs:type types do not match. No exception will be thrown.
-
- The method is generally invoked before invoking the method which is used to fill the .
-
- Classes that derive from the class include , , , and .
-
+> Data corruption can occur if the msdata:DataType and the xs:type types do not match. No exception will be thrown.
+
+ The method is generally invoked before invoking the method which is used to fill the .
+
+ Classes that derive from the class include , , , and .
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is be thrown when you attempt to read the schema into the with . This exception does not occur if you are using .NET Framework version 1.0.
-
-
-
-## Examples
- The following example creates a object to read an XML schema with, and invokes the method with the object.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is be thrown when you attempt to read the schema into the with . This exception does not occur if you are using .NET Framework version 1.0.
+
+
+
+## Examples
+ The following example creates a object to read an XML schema with, and invokes the method with the object.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema1 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema1 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema1 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -5051,31 +5018,31 @@ class Program {
The from which to read.
Reads the XML schema from the specified into the .
- method to create the schema for a . The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
-
- The XML schema is written using the XSD standard.
-
+ method to create the schema for a . The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
+
+ The XML schema is written using the XSD standard.
+
> [!NOTE]
-> Data corruption can occur if the msdata:DataType and the xs:type types do not match. No exception will be thrown.
-
- The method is generally invoked before invoking the method which is used to fill the .
-
- Classes that inherit from the class include the and classes.
-
+> Data corruption can occur if the msdata:DataType and the xs:type types do not match. No exception will be thrown.
+
+ The method is generally invoked before invoking the method which is used to fill the .
+
+ Classes that inherit from the class include the and classes.
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is be thrown when you attempt to read the schema into the with . This exception does not occur if you are using .NET Framework version 1.0.
-
-
-
-## Examples
- The following example creates a object to read a schema with, and invokes the method with the object.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is be thrown when you attempt to read the schema into the with . This exception does not occur if you are using .NET Framework version 1.0.
+
+
+
+## Examples
+ The following example creates a object to read a schema with, and invokes the method with the object.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema2 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema2 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema2 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -5127,27 +5094,27 @@ class Program {
The file name (including the path) from which to read.
Reads the XML schema from the specified file into the .
- method to create the schema for a . The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
-
- The XML schema is written using the XSD standard.
-
+ method to create the schema for a . The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
+
+ The XML schema is written using the XSD standard.
+
> [!NOTE]
-> Data corruption can occur if the msdata:DataType and the xs:type types do not match. No exception will be thrown.
-
- The method is generally invoked before invoking the method which is used to fill the .
-
+> Data corruption can occur if the msdata:DataType and the xs:type types do not match. No exception will be thrown.
+
+ The method is generally invoked before invoking the method which is used to fill the .
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with . This exception does not occur if you are using .NET Framework version 1.0.
-
-
-
-## Examples
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is thrown when you attempt to read the schema into the with . This exception does not occur if you are using .NET Framework version 1.0.
+
+
+
+## Examples
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema3 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema3 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema3 Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -5206,31 +5173,31 @@ class Program {
The from which to read.
Reads the XML schema from the specified into the .
- method to create the schema for a . The schema includes table, relation, and constraint definitions.
-
- The XML schema is written using the XSD standard.
-
+ method to create the schema for a . The schema includes table, relation, and constraint definitions.
+
+ The XML schema is written using the XSD standard.
+
> [!NOTE]
-> Data corruption can occur if the msdata:DataType and the xs:type types do not match. No exception will be thrown.
-
- The method is generally invoked before invoking the method which is used to fill the .
-
- The class is abstract. A class that inherits from the `XmlReader` is the class.
-
+> Data corruption can occur if the msdata:DataType and the xs:type types do not match. No exception will be thrown.
+
+ The method is generally invoked before invoking the method which is used to fill the .
+
+ The class is abstract. A class that inherits from the `XmlReader` is the class.
+
> [!NOTE]
-> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is be thrown when you attempt to read the schema into the with . This exception does not occur if you are using .NET Framework version 1.0.
-
-
-
-## Examples
- The following example creates a new and object. The object, created with a file path and file name, is used to create an that is passed as an argument to the method.
-
+> If the schema for your contains elements of the same name, but different type, in the same namespace, an exception is be thrown when you attempt to read the schema into the with . This exception does not occur if you are using .NET Framework version 1.0.
+
+
+
+## Examples
+ The following example creates a new and object. The object, created with a file path and file name, is used to create an that is passed as an argument to the method.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXmlSchema Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -5321,25 +5288,25 @@ class Program {
Rolls back all the changes made to the since it was created, or since the last time was called.
- to call the method on all objects contained by the .
-
- objects contained by the can each be set into edit mode by invoking the method. After invoking the method, changes can be rejected by calling the on the to which the objects belong.
-
- When the method is called, any rows still in edit-mode cancel their edits. New rows are removed. Modified and deleted rows return back to their original state (`DataRowState.Unchanged`).
-
- AcceptChanges and RejectChanges only apply to related changes (that is, `Add`, `Remove`, `Delete`, and `Modify`). They are not applicable to schema or structural changes.
-
-
-
-## Examples
- The following example shows a class derived from the class. The event is invoked from within a function.
-
+ to call the method on all objects contained by the .
+
+ objects contained by the can each be set into edit mode by invoking the method. After invoking the method, changes can be rejected by calling the on the to which the objects belong.
+
+ When the method is called, any rows still in edit-mode cancel their edits. New rows are removed. Modified and deleted rows return back to their original state (`DataRowState.Unchanged`).
+
+ AcceptChanges and RejectChanges only apply to related changes (that is, `Add`, `Remove`, `Delete`, and `Modify`). They are not applicable to schema or structural changes.
+
+
+
+## Examples
+ The following example shows a class derived from the class. The event is invoked from within a function.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.RejectChanges Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.RejectChanges Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.RejectChanges Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -5392,13 +5359,13 @@ class Program {
Gets the collection of relations that link tables and allow navigation from parent tables to child tables.
A that contains a collection of objects. An empty collection is returned if no objects exist.
- property.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Relations Example/VB/source.vb" id="Snippet1":::
-
+ property.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Relations Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -5536,19 +5503,19 @@ class Program {
Gets or sets a for a .
A for a .
- serializes its schema and instance data by default in Web services and remoting scenarios. Setting the property of a typed `DataSet` to causes schema information to be excluded from the serialization payload.
-
- is supported only for a typed `DataSet`. For an un-typed `DataSet` this property can only be set to .
-
- should only be used in cases where the schema information of the underlying typed `DataTables`, `DataRelations` and `Constraints` has not been modified. If modifications have occurred, complete schema information should be serialized with .
-
- is supported in version 2.0 of the .NET Framework or later.
-
- When is set, only the top level runtime properties present on the are serialized. In addition, they are serialized only if they happen to be different from the default values. None of the `Tables`, `Relations` or `Constraints` are serialized. The serialized runtime properties include , , , , , and . These properties are serialized to make sure that overall runtime data integrity is preserved.
-
+ serializes its schema and instance data by default in Web services and remoting scenarios. Setting the property of a typed `DataSet` to causes schema information to be excluded from the serialization payload.
+
+ is supported only for a typed `DataSet`. For an un-typed `DataSet` this property can only be set to .
+
+ should only be used in cases where the schema information of the underlying typed `DataTables`, `DataRelations` and `Constraints` has not been modified. If modifications have occurred, complete schema information should be serialized with .
+
+ is supported in version 2.0 of the .NET Framework or later.
+
+ When is set, only the top level runtime properties present on the are serialized. In addition, they are serialized only if they happen to be different from the default values. None of the `Tables`, `Relations` or `Constraints` are serialized. The serialized runtime properties include , , , , , and . These properties are serialized to make sure that overall runtime data integrity is preserved.
+
]]>
Using DataSets in ADO.NET
@@ -5593,19 +5560,19 @@ class Program {
if the property value has been changed from its default; otherwise, .
- , or creating your own control incorporating the .
-
-
-
-## Examples
- The following examples show a class derived from the class. The and methods are invoked from within functions in the derived class.
-
+ , or creating your own control incorporating the .
+
+
+
+## Examples
+ The following examples show a class derived from the class. The and methods are invoked from within functions in the derived class.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ShouldSerializeRelations Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ShouldSerializeRelations Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ShouldSerializeRelations Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -5650,19 +5617,19 @@ class Program {
if the property value has been changed from its default; otherwise, .
- , or creating your own control incorporating the .
-
-
-
-## Examples
- The following example shows a class derived from the class. The method is called from within functions in the derived class.
-
+ , or creating your own control incorporating the .
+
+
+
+## Examples
+ The following example shows a class derived from the class. The method is called from within functions in the derived class.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ShouldSerializeTables Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ShouldSerializeTables Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ShouldSerializeTables Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -5728,11 +5695,11 @@ class Program {
Gets or sets an for the .
An for the .
- to a and enable communication between them, as well as provide a way for the container to manage its components.
-
+ to a and enable communication between them, as well as provide a way for the container to manage its components.
+
]]>
Using DataSets in ADO.NET
@@ -5777,11 +5744,11 @@ class Program {
For a description of this member, see .
For a description of this member, see .
- instance is cast to an interface.
-
+ instance is cast to an interface.
+
]]>
@@ -5827,11 +5794,11 @@ class Program {
For a description of this member, see .
For a description of this member, see .
- instance is cast to an interface.
-
+ instance is cast to an interface.
+
]]>
@@ -5912,11 +5879,11 @@ class Program {
For a description of this member, see .
For a description of this member, see .
- instance is cast to an interface.
-
+ instance is cast to an interface.
+
]]>
@@ -5964,11 +5931,11 @@ class Program {
A .
For a description of this member, see .
- instance is cast to an interface.
-
+ instance is cast to an interface.
+
]]>
@@ -6016,11 +5983,11 @@ class Program {
A .
For a description of this member, see .
- instance is cast to an interface.
-
+ instance is cast to an interface.
+
]]>
@@ -6072,19 +6039,19 @@ class Program {
Gets the collection of tables contained in the .
The contained by this . An empty collection is returned if no objects exist.
- method of the . To remove tables, use the method.
-
-
-
-## Examples
- The following example returns the object's , and prints the columns and rows in each table.
-
+ method of the . To remove tables, use the method.
+
+
+
+## Examples
+ The following example returns the object's , and prints the columns and rows in each table.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.Tables Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Tables Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Tables Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -6152,24 +6119,24 @@ class Program {
A object used to write to a file.
Writes the current data for the using the specified .
- into an XML document, whereas the method writes only the schema. To write both data and schema, use one of the overloads that includes the `mode` parameter, and set its value to `WriteSchema`.
-
- Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
-
+ into an XML document, whereas the method writes only the schema. To write both data and schema, use one of the overloads that includes the `mode` parameter, and set its value to `WriteSchema`.
+
+ Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
-
-
-## Examples
- The following example creates a object. The object is then used with the method to write an XML document.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+
+
+## Examples
+ The following example creates a object. The object is then used with the method to write an XML document.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -6226,16 +6193,16 @@ class Program {
The object with which to write.
Writes the current data for the using the specified .
- into an XML document, whereas the method writes only the schema. To write both data and schema, use one of the overloads that includes the `mode` parameter, and set its value to `WriteSchema`.
-
- Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
-
+ into an XML document, whereas the method writes only the schema. To write both data and schema, use one of the overloads that includes the `mode` parameter, and set its value to `WriteSchema`.
+
+ Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
]]>
Using DataSets in ADO.NET
@@ -6287,16 +6254,16 @@ class Program {
The file name (including the path) to which to write.
Writes the current data for the to the specified file.
- into an XML document, whereas the method writes only the schema. To write both data and schema, use one of the overloads that includes the `mode` parameter, and set its value to `WriteSchema`.
-
- Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
-
+ into an XML document, whereas the method writes only the schema. To write both data and schema, use one of the overloads that includes the `mode` parameter, and set its value to `WriteSchema`.
+
+ Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
]]>
@@ -6355,16 +6322,16 @@ class Program {
The with which to write.
Writes the current data for the to the specified .
- into an XML document, whereas the method writes only the schema. To write both data and schema, use one of the overloads that includes the `mode` parameter, and set its value to `WriteSchema`.
-
- Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
-
+ into an XML document, whereas the method writes only the schema. To write both data and schema, use one of the overloads that includes the `mode` parameter, and set its value to `WriteSchema`.
+
+ Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
]]>
Using DataSets in ADO.NET
@@ -6423,16 +6390,16 @@ class Program {
One of the values.
Writes the current data, and optionally the schema, for the using the specified and . To write the schema, set the value for the parameter to .
- into an XML document, whereas the method writes only the schema. To write both data and schema, set the `mode` parameter to `WriteSchema`.
-
- Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
-
+ into an XML document, whereas the method writes only the schema. To write both data and schema, set the `mode` parameter to `WriteSchema`.
+
+ Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
]]>
Using DataSets in ADO.NET
@@ -6491,24 +6458,24 @@ class Program {
One of the values.
Writes the current data, and optionally the schema, for the using the specified and . To write the schema, set the value for the parameter to .
- into an XML document, whereas the method writes only the schema. To write both data and schema, set the `mode` parameter to `WriteSchema`.
-
- Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
-
+ into an XML document, whereas the method writes only the schema. To write both data and schema, set the `mode` parameter to `WriteSchema`.
+
+ Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
-
-
-## Examples
- The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+
+
+## Examples
+ The following example first creates a simple with one , two columns, and ten rows. The schema and data are written to disk by invoking the method. A second is created and the method is used to fill it with schema and data.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml2 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml2 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.ReadXml2 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -6562,24 +6529,24 @@ class Program {
One of the values.
Writes the current data, and optionally the schema, for the to the specified file using the specified . To write the schema, set the value for the parameter to .
- into an XML document, whereas the method writes only the schema. To write both data and schema, set the `mode` parameter to `WriteSchema`.
-
- Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
-
+ into an XML document, whereas the method writes only the schema. To write both data and schema, set the `mode` parameter to `WriteSchema`.
+
+ Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
-
-
-## Examples
- The following example uses the method to write an XML document.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+
+
+## Examples
+ The following example uses the method to write an XML document.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml7 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml7 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml7 Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -6640,24 +6607,24 @@ class Program {
One of the values.
Writes the current data, and optionally the schema, for the using the specified and . To write the schema, set the value for the parameter to .
- into an XML document, whereas the method writes only the schema. To write both data and schema, set the `mode` parameter to `WriteSchema`.
-
- Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
-
+ into an XML document, whereas the method writes only the schema. To write both data and schema, set the `mode` parameter to `WriteSchema`.
+
+ Note that the same is true for the and methods, respectively. To read XML data, or both schema and data into the `DataSet`, use the `ReadXml` method. To read just the schema, use the `ReadXmlSchema` method.
+
> [!NOTE]
-> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
-
-
-
-## Examples
- The following example creates a object that is used to create a new . The object is used with the method to write an XML document.
-
+> An will be thrown if a column type in the `DataRow` being read from or written to implements and does not implement .
+
+
+
+## Examples
+ The following example creates a object that is used to create a new . The object is used with the method to write an XML document.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml6 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml6 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXml6 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -6725,25 +6692,25 @@ class Program {
A object used to write to a file.
Writes the structure as an XML schema to the specified object.
- method to write the schema for a to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
-
- The XML schema is written using the XSD standard.
-
- To write the data to an XML document, use the method.
-
- Classes that derive from the class include , , , and .
-
-
-
-## Examples
- The following example creates a new object that is passed to the method to write the schema to disk.
-
+ method to write the schema for a to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
+
+ The XML schema is written using the XSD standard.
+
+ To write the data to an XML document, use the method.
+
+ Classes that derive from the class include , , , and .
+
+
+
+## Examples
+ The following example creates a new object that is passed to the method to write the schema to disk.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -6800,25 +6767,25 @@ class Program {
The object with which to write.
Writes the structure as an XML schema to the specified object.
- method to write the schema for a to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
-
- The XML schema is written using the XSD standard.
-
- To write the data to an XML document, use the method.
-
- Classes the derive from the class include the , , , , and .
-
-
-
-## Examples
- The following example creates a object to that is used to create a new . The is passed to the method, and the resulting string is printed to the console window.
-
+ method to write the schema for a to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
+
+ The XML schema is written using the XSD standard.
+
+ To write the data to an XML document, use the method.
+
+ Classes the derive from the class include the , , , , and .
+
+
+
+## Examples
+ The following example creates a object to that is used to create a new . The is passed to the method, and the resulting string is printed to the console window.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema1 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema1 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema1 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
@@ -6870,21 +6837,21 @@ class Program {
The file name (including the path) to which to write.
Writes the structure as an XML schema to a file.
- method to write the schema for a to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
-
- The XML schema is written using the XSD standard.
-
- To write the data to an XML document, use the method.
-
-
-
-## Examples
+ method to write the schema for a to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
+
+ The XML schema is written using the XSD standard.
+
+ To write the data to an XML document, use the method.
+
+
+
+## Examples
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema3 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema3 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema3 Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -6943,25 +6910,25 @@ class Program {
The to write to.
Writes the structure as an XML schema to an object.
- method to write the schema for a to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
-
- The XML schema is written using the XSD standard.
-
- To write the data to an XML document, use the method.
-
- One class that inherits from the class is the class.
-
-
-
-## Examples
- The following example creates a new object with the specified path. The object is used to create an object. The method is then invoked with the object to write the schema to the disk.
-
+ method to write the schema for a to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the method.
+
+ The XML schema is written using the XSD standard.
+
+ To write the data to an XML document, use the method.
+
+ One class that inherits from the class is the class.
+
+
+
+## Examples
+ The following example creates a new object with the specified path. The object is used to create an object. The method is then invoked with the object to write the schema to the disk.
+
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema2 Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema2 Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.WriteXmlSchema2 Example/VB/source.vb" id="Snippet1":::
+
]]>
Using DataSets in ADO.NET
diff --git a/xml/System.Data/DataTable.xml b/xml/System.Data/DataTable.xml
index 64b86e6abd4..f085fd131ac 100644
--- a/xml/System.Data/DataTable.xml
+++ b/xml/System.Data/DataTable.xml
@@ -131,53 +131,15 @@
Represents one table of in-memory data.
-
+ For more information about this API, see Supplemental API remarks for DataTable.
+
objects and one object, and adds the new objects to a . The tables are then displayed in a control.
-## Remarks
-
- The is a central object in the ADO.NET library. Other objects that use the include the and the .
-
- When accessing objects, note that they are conditionally case sensitive. For example, if one is named "mydatatable" and another is named "Mydatatable", a string used to search for one of the tables is regarded as case sensitive. However, if "mydatatable" exists and "Mydatatable" does not, the search string is regarded as case insensitive. A can contain two objects that have the same property value but different property values. For more information about working with objects, see [Creating a DataTable](/dotnet/framework/data/adonet/dataset-datatable-dataview/creating-a-datatable).
-
- If you are creating a programmatically, you must first define its schema by adding objects to the (accessed through the property). For more information about adding objects, see [Adding Columns to a DataTable](/dotnet/framework/data/adonet/dataset-datatable-dataview/adding-columns-to-a-datatable).
-
- To add rows to a , you must first use the method to return a new object. The method returns a row with the schema of the , as it is defined by the table's . The maximum number of rows that a can store is 16,777,216. For more information, see [Adding Data to a DataTable](/dotnet/framework/data/adonet/dataset-datatable-dataview/adding-data-to-a-datatable).
-
- The also contains a collection of objects that can be used to ensure the integrity of the data. For more information, see [DataTable Constraints](/dotnet/framework/data/adonet/dataset-datatable-dataview/datatable-constraints).
-
- There are many events that can be used to determine when changes are made to a table. These include , , , and . For more information about the events that can be used with a , see [Handling DataTable Events](/dotnet/framework/data/adonet/dataset-datatable-dataview/handling-datatable-events).
-
- When an instance of is created, some of the read/write properties are set to initial values. For a list of these values, see the constructor topic.
-
-> [!NOTE]
-> The and objects inherit from and support the interface for .NET Framework remoting. These are the only ADO.NET objects that you can use for .NET Framework remoting.
-
-### Security considerations
-
-For information about DataSet and DataTable security, see [Security guidance](/dotnet/framework/data/adonet/dataset-datatable-dataview/security-guidance).
-
-## Examples
- The following example creates two objects and one object, and adds the new objects to a . The tables are then displayed in a control.
-
- :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable Example/CS/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable Example/VB/source.vb" id="Snippet1":::
-
- This sample demonstrates how to create a DataTable manually with specific schema definitions:
-
-- Create multiple DataTables and define the initial columns.
-
-- Create the table constraints.
-
-- Insert the values and display the tables.
-
-- Create the expression columns and display the tables.
-
- :::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/classic webdata datatable example2/cs/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/classic webdata datatable example2/vb/source.vb" id="Snippet1":::
-
- ]]>
-
+:::code language="csharp" source="~/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable Example/CS/source.cs" id="Snippet1":::
+:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable Example/VB/source.vb" id="Snippet1":::
+ ]]>
+
This type is safe for multithreaded read operations. You must synchronize any write operations.
DataTables
diff --git a/xml/System.Diagnostics.Tracing/EventSource.xml b/xml/System.Diagnostics.Tracing/EventSource.xml
index 0cc9e59f901..b813ec6fcdc 100644
--- a/xml/System.Diagnostics.Tracing/EventSource.xml
+++ b/xml/System.Diagnostics.Tracing/EventSource.xml
@@ -1,380 +1,315 @@
-
-
-
-
-
-
-
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
-
-
-
-
-
-
-
-
- System.Object
-
-
-
- System.IDisposable
-
-
-
-
- [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
- [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)>]
-
-
- [System.Runtime.CompilerServices.Nullable(0)]
- [<System.Runtime.CompilerServices.Nullable(0)>]
-
-
- [System.Runtime.CompilerServices.NullableContext(2)]
- [<System.Runtime.CompilerServices.NullableContext(2)>]
-
-
-
- Provides the ability to create events for event tracing across platforms.
-
- methods are called to log the events.
-
- The basic functionality of is sufficient for most applications. If you want more control over the event metadata that's created, you can apply the attribute to the methods. For advanced event source applications, it is possible to intercept the commands being sent to the derived event source and change the filtering, or to cause actions (such as dumping a data structure) to be performed by the inheritor. An event source can be activated in-process using and out-of-process using EventPipe-based tools such as `dotnet-trace` or Event Tracing for Windows (ETW) based tools like `PerfView` or `Logman`. It is also possible to programmatically control and intercept the data dispatcher. The class provides additional functionality.
-
-### Conventions
- -derived classes should follow the following conventions:
-
- - User-defined classes should implement a singleton pattern. The singleton instance is traditionally named `Log`. By extension, users should not call `IDisposable.Dispose` manually and allow the runtime to clean up the singleton instance at the end of managed code execution.
- - A user-defined, derived class should be marked as `sealed` unless it implements the advanced "Utility EventSource" configuration discussed in the Advanced Usage section.
- - Call before performing any resource intensive work related to firing an event.
- - You can implicitly create objects by declaring two event methods with subsequent event IDs that have the naming pattern `Start` and `Stop`. These events _must_ be declared next to each other in the class definition and the `Start` method _must_ come first.
- - Attempt to keep objects backwards compatible and version them appropriately. The default version for an event is `0`. The version can be can be changed by setting . Change the version of an event whenever you change properties of the payload. Always add new payload properties to the end of the event declaration. If this is not possible, create a new event with a new ID to replace the old one.
- - When declaring event methods, specify fixed-size payload properties before variably sized properties.
- - are used as a bit mask for specifying specific events when subscribing to a provider. You can specify keywords by defining a `public static class Keywords` member class that has `public const EventKeywords` members.
- - Associate expensive events with an using . This pattern allows users of your to opt out of these expensive operations.
-
-### Self-describing (tracelogging) vs. manifest event formats
- can be configured into to two different modes based on the constructor used or what flags are set on .
-
- Historically, these two formats are derived from two formats that Event Tracing for Windows (ETW) used. While these two modes don't affect your ability to use Event Tracing for Windows (ETW) or EventPipe-based listeners, they do generate the metadata for events differently.
-
- The default event format is , which is set if not specified on . Manifest-based objects generate an XML document representing the events defined on the class upon initialization. This requires the to reflect over itself to generate the provider and event metadata.
-
- To use self-describing (tracelogging) event format, construct your using the constructor, the constructor, or by setting the `EtwSelfDescribingEventFormat` flag on . Self-describing sources generate minimal provider metadata on initialization and only generate event metadata when is called.
-
- In practice, these event format settings only affect usage with readers based on Event Tracing for Windows (ETW). They can, however, have a small effect on initialization time and per-event write times due to the time required for reflection and generating the metadata.
-
-### Examples
- The following example shows a simple implementation of the class.
-
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics.Tracing/EventSource/Overview/program1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/etwtracesmall/vb/program.vb" id="Snippet1":::
-
- The following example shows a more complex implementation of the class.
-
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics.Tracing/EventAttribute/Overview/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/etwtrace/vb/program.vb" id="Snippet1":::
-
-
-### Advanced Usage
- Traditionally, user-defined objects expect to inherit directly from . For advanced scenarios, however, you can create `abstract` objects, called *Utility Sources*, and implement interfaces. Using one or both of these techniques allows you to share code between different derived sources.
-
-> [!IMPORTANT]
-> Abstract objects cannot define keywords, tasks, opcodes, channels, or events.
-
-> [!IMPORTANT]
-> To avoid name collisions at run time when generating event metadata, don't explicitly implement interface methods when using interfaces with .
-
-The following example shows an implementation of that uses an interface.
-
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics.Tracing/EventSource/Overview/program.cs" id="InterfaceSource":::
-
-The following example shows an implementation of that uses the Utility EventSource pattern.
-
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics.Tracing/EventSource/Overview/program.cs" id="UtilitySource":::
-
-The following example shows an implementation of for tracing information about a component in a library.
-
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics.Tracing/EventSource/Overview/program.cs" id="ComplexSource":::
-
- ]]>
-
- This type is thread safe.
-
-
-
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
-
-
- Creates a new instance of the class.
-
-
-
-
-
-
-
-
- Constructor
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- Creates a new instance of the class.
- To be added.
-
-
-
-
-
-
-
-
-
- Constructor
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
-
-
-
- to throw an exception when an error occurs in the underlying Windows code; otherwise, .
- Creates a new instance of the class and specifies whether to throw an exception when an error occurs in the underlying Windows code.
- To be added.
-
-
-
-
-
-
-
-
-
- Constructor
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
-
-
- A bitwise combination of the enumeration values that specify the configuration settings to apply to the event source.
- Creates a new instance of the class with the specified configuration settings.
-
+
+
+
+
+
+
+
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+
+
+
+
+
+
+
+
+ System.Object
+
+
+
+ System.IDisposable
+
+
+
+
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
+ [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)>]
+
+
+ [System.Runtime.CompilerServices.Nullable(0)]
+ [<System.Runtime.CompilerServices.Nullable(0)>]
+
+
+ [System.Runtime.CompilerServices.NullableContext(2)]
+ [<System.Runtime.CompilerServices.NullableContext(2)>]
+
+
+
+ Provides the ability to create events for event tracing across platforms.
+ For more information about this API, see Supplemental API remarks for EventSource.
+ This type is thread safe.
+
+
+
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+
+
+ Creates a new instance of the class.
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ Creates a new instance of the class.
+ To be added.
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+
+
+
+ to throw an exception when an error occurs in the underlying Windows code; otherwise, .
+ Creates a new instance of the class and specifies whether to throw an exception when an error occurs in the underlying Windows code.
+ To be added.
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+
+
+ A bitwise combination of the enumeration values that specify the configuration settings to apply to the event source.
+ Creates a new instance of the class with the specified configuration settings.
+
is constructed enables you to specify whether the event is written in a manifest-based or a self-describing format. In addition, you can specify that an exception should be raised when an error occurs during the event-writing process.
- ]]>
-
-
-
-
-
-
-
-
-
-
- Constructor
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
-
-
-
- The name to apply to the event source. Must not be .
- Creates a new instance of the class with the specified name.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+
+
+
+ The name to apply to the event source. Must not be .
+ Creates a new instance of the class with the specified name.
+
attribute on that type. Otherwise, the GUIDs returned by the property and the method will be different. If the event source names differ, the property returns the GUID used to register this EventSource with ETW.
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
- Constructor
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
-
-
-
- [System.ParamArray]
- [<System.ParamArray>]
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
-
-
-
-
-
- A bitwise combination of the enumeration values that specify the configuration settings to apply to the event source.
- The key-value pairs that specify traits for the event source.
- Initializes a new instance of the to be used with non-contract events that contains the specified settings and traits.
-
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+
+
+
+ [System.ParamArray]
+ [<System.ParamArray>]
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
+
+
+
+
+
+ A bitwise combination of the enumeration values that specify the configuration settings to apply to the event source.
+ The key-value pairs that specify traits for the event source.
+ Initializes a new instance of the to be used with non-contract events that contains the specified settings and traits.
+
is constructed enables you to specify whether the event is written in a manifest-based or a self-describing format. In addition, you can specify that an exception should be raised when an error occurs during the event-writing process.
- ]]>
-
-
- is not specified in key-value pairs.
-
-
-
-
-
-
-
-
-
-
- Constructor
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
-
-
-
-
- The name to apply to the event source. Must not be .
- A bitwise combination of the enumeration values that specify the configuration settings to apply to the event source.
- Creates a new instance of the class with the specified name and settings.
-
+ ]]>
+
+
+ is not specified in key-value pairs.
+
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+
+
+
+
+ The name to apply to the event source. Must not be .
+ A bitwise combination of the enumeration values that specify the configuration settings to apply to the event source.
+ Creates a new instance of the class with the specified name and settings.
+
property returns the GUID used to register this EventSource with ETW.
- ]]>
-
-
- is .
-
-
-
-
-
-
-
-
-
-
- Constructor
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
-
-
-
-
-
- [System.ParamArray]
- [<System.ParamArray>]
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
-
-
-
-
-
- The name to apply to the event source. Must not be .
- A bitwise combination of the enumeration values that specify the configuration settings to apply to the event source.
- The key-value pairs that specify traits for the event source.
- Creates a new instance of the class with the specified configuration settings.
-
+ ]]>
+
+
+ is .
+
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+
+
+
+
+
+ [System.ParamArray]
+ [<System.ParamArray>]
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
+
+
+
+
+
+ The name to apply to the event source. Must not be .
+ A bitwise combination of the enumeration values that specify the configuration settings to apply to the event source.
+ The key-value pairs that specify traits for the event source.
+ Creates a new instance of the class with the specified configuration settings.
+
attribute on that type. Otherwise, the GUIDs returned by the property and the method will be different.
In such cases, the GUID used to register this EventSource with ETW is the one returned by .
- ]]>
-
-
- is .
-
- is not specified in key-value pairs.
-
-
-
-
-
-
-
-
-
-
-
- Property
-
- System.Diagnostics.Tracing
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Exception
-
-
- Gets any exception that was thrown during the construction of the event source.
- The exception that was thrown during the construction of the event source, or if no exception was thrown.
-
+ ]]>
+
+
+ is .
+
+ is not specified in key-value pairs.
+
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ System.Diagnostics.Tracing
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Exception
+
+
+ Gets any exception that was thrown during the construction of the event source.
+ The exception that was thrown during the construction of the event source, or if no exception was thrown.
+
constructors do not throw exceptions. Instead, any exception that is thrown is assigned to the property and logged by the method.
- ]]>
-
-
-
-
-
-
-
-
-
-
- Property
-
- System.Diagnostics.Tracing
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [get: System.Security.SecurityCritical]
- [<get: System.Security.SecurityCritical>]
-
-
- [get: System.Security.SecuritySafeCritical]
- [<get: System.Security.SecuritySafeCritical>]
-
-
-
- System.Guid
-
-
- Gets the activity ID of the current thread.
- The activity ID of the current thread.
- To be added.
-
-
-
-
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
-
-
- Releases all resources used by the current instance of the class.
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.IDisposable.Dispose
-
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
- Releases all resources used by the current instance of the class.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ System.Diagnostics.Tracing
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [get: System.Security.SecurityCritical]
+ [<get: System.Security.SecurityCritical>]
+
+
+ [get: System.Security.SecuritySafeCritical]
+ [<get: System.Security.SecuritySafeCritical>]
+
+
+
+ System.Guid
+
+
+ Gets the activity ID of the current thread.
+ The activity ID of the current thread.
+ To be added.
+
+
+
+
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+
+
+ Releases all resources used by the current instance of the class.
+
+
+
+
+
+
+
+
+
+ Method
+
+ M:System.IDisposable.Dispose
+
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+ Releases all resources used by the current instance of the class.
+
[!NOTE]
> Always call `Dispose` before you release your last reference to the . Otherwise, the resources it is using will not be freed until the garbage collector calls the object's `Finalize` method.
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
-
-
-
- to release both managed and unmanaged resources; to release only unmanaged resources.
- Releases the unmanaged resources used by the class and optionally releases the managed resources.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ to release both managed and unmanaged resources; to release only unmanaged resources.
+ Releases the unmanaged resources used by the class and optionally releases the managed resources.
+
references. This method invokes the `Dispose()` method of each referenced object.
- ]]>
-
-
-
+ ]]>
+
+
+
can be called multiple times by other objects. When overriding , be careful not to reference objects that have been previously disposed in an earlier the Dispose Method call to . For more information about how to implement , see [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).
- For more information about and , see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged).
-
-
-
-
-
-
-
-
-
-
-
- Event
-
- System.Diagnostics.Tracing
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
-
-
- [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
- [<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
-
-
-
- System.EventHandler<System.Diagnostics.Tracing.EventCommandEventArgs>
-
-
- Occurs when a command comes from an event listener.
- To be added.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Void
-
-
-
- Allows the object to attempt to free resources and perform other cleanup operations before the object is reclaimed by garbage collection.
- To be added.
-
-
-
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
-
-
- Returns a string of the XML manifest that is associated with the current event source.
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.String
-
-
-
-
-
- [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
- [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)>]
-
-
- [System.Runtime.CompilerServices.Nullable(1)]
- [<System.Runtime.CompilerServices.Nullable(1)>]
-
-
-
-
-
-
- The type of the event source.
- The path to the assembly file (.dll) to include in the provider element of the manifest.
- Returns a string of the XML manifest that is associated with the current event source.
- The XML data string.
-
+ For more information about and , see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged).
+
+
+
+
+
+
+
+
+
+
+
+ Event
+
+ System.Diagnostics.Tracing
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1 })>]
+
+
+ [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+ [<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
+
+
+
+ System.EventHandler<System.Diagnostics.Tracing.EventCommandEventArgs>
+
+
+ Occurs when a command comes from an event listener.
+ To be added.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Void
+
+
+
+ Allows the object to attempt to free resources and perform other cleanup operations before the object is reclaimed by garbage collection.
+ To be added.
+
+
+
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+
+
+ Returns a string of the XML manifest that is associated with the current event source.
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.String
+
+
+
+
+
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
+ [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)>]
+
+
+ [System.Runtime.CompilerServices.Nullable(1)]
+ [<System.Runtime.CompilerServices.Nullable(1)>]
+
+
+
+
+
+
+ The type of the event source.
+ The path to the assembly file (.dll) to include in the provider element of the manifest.
+ Returns a string of the XML manifest that is associated with the current event source.
+ The XML data string.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.String
-
-
-
-
-
- [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
- [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)>]
-
-
- [System.Runtime.CompilerServices.Nullable(1)]
- [<System.Runtime.CompilerServices.Nullable(1)>]
-
-
-
-
-
-
-
- The type of the event source.
- The path to the assembly file (.dll) file to include in the provider element of the manifest.
- A bitwise combination of the enumeration values that specify how the manifest is generated.
- Returns a string of the XML manifest that is associated with the current event source.
- The XML data string or .
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.String
+
+
+
+
+
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
+ [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)>]
+
+
+ [System.Runtime.CompilerServices.Nullable(1)]
+ [<System.Runtime.CompilerServices.Nullable(1)>]
+
+
+
+
+
+
+
+ The type of the event source.
+ The path to the assembly file (.dll) file to include in the provider element of the manifest.
+ A bitwise combination of the enumeration values that specify how the manifest is generated.
+ Returns a string of the XML manifest that is associated with the current event source.
+ The XML data string or .
+
returns `null`.
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.Guid
-
-
-
-
-
- The type of the event source.
- Gets the unique identifier for this implementation of the event source.
- A unique identifier for this event source type.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.Guid
+
+
+
+
+
+ The type of the event source.
+ Gets the unique identifier for this implementation of the event source.
+ A unique identifier for this event source type.
+
that was passed to the constructor isn't specified as an , this method can return a different GUID to the one returned by the property.
In such cases, the GUID that is used to register the is the one returned by property.
- ]]>]
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.String
-
-
-
-
-
- The type of the event source.
- Gets the friendly name of the event source.
- The friendly name of the event source. The default is the simple name of the class.
- To be added.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.Collections.Generic.IEnumerable<System.Diagnostics.Tracing.EventSource>
-
-
-
- Gets a snapshot of all the event sources for the application domain.
- An enumeration of all the event sources in the application domain.
- To be added.
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.String
-
-
-
-
-
- The key of the trait to get.
- Gets the trait value associated with the specified key.
- The trait value associated with the specified key. If the key is not found, returns .
-
+ ]]>]
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.String
+
+
+
+
+
+ The type of the event source.
+ Gets the friendly name of the event source.
+ The friendly name of the event source. The default is the simple name of the class.
+ To be added.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.Collections.Generic.IEnumerable<System.Diagnostics.Tracing.EventSource>
+
+
+
+ Gets a snapshot of all the event sources for the application domain.
+ An enumeration of all the event sources in the application domain.
+ To be added.
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.String
+
+
+
+
+
+ The key of the trait to get.
+ Gets the trait value associated with the specified key.
+ The trait value associated with the specified key. If the key is not found, returns .
+
-
-
-
-
-
-
-
-
-
-
- Property
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Guid
-
-
- The unique identifier for the event source.
- A unique identifier for the event source.
- To be added.
-
-
-
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
-
-
- Determines whether the current event source is enabled.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
- [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
-
-
-
- System.Boolean
-
-
-
- Determines whether the current event source is enabled.
-
- if the current event source is enabled; otherwise, .
- To be added.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Boolean
-
-
-
-
-
-
- The level of the event source.
- The keyword of the event source.
- Determines whether the current event source that has the specified level and keyword is enabled.
-
- if the event source is enabled; otherwise, .
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Guid
+
+
+ The unique identifier for the event source.
+ A unique identifier for the event source.
+ To be added.
+
+
+
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+
+
+ Determines whether the current event source is enabled.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
+ [<System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")>]
+
+
+
+ System.Boolean
+
+
+
+ Determines whether the current event source is enabled.
+
+ if the current event source is enabled; otherwise, .
+ To be added.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Boolean
+
+
+
+
+
+
+ The level of the event source.
+ The keyword of the event source.
+ Determines whether the current event source that has the specified level and keyword is enabled.
+
+ if the event source is enabled; otherwise, .
+
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Boolean
-
-
-
-
-
-
-
- The event level to check. An event source will be considered enabled when its level is greater than or equal to .
- The event keywords to check.
- The event channel to check.
- Determines whether the current event source is enabled for events with the specified level, keywords and channel.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Boolean
+
+
+
+
+
+
+
+ The event level to check. An event source will be considered enabled when its level is greater than or equal to .
+ The event keywords to check.
+ The event channel to check.
+ Determines whether the current event source is enabled for events with the specified level, keywords and channel.
+
if the event source is enabled for the specified event level, keywords and channel; otherwise, .
- The result of this method is only an approximation of whether a particular event is active. Use it to avoid expensive computation for logging when logging is disabled. Event sources may have additional filtering that determines their activity.
-
+ The result of this method is only an approximation of whether a particular event is active. Use it to avoid expensive computation for logging when logging is disabled. Event sources may have additional filtering that determines their activity.
+
-
-
-
-
-
-
-
-
-
-
- Property
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.Nullable(1)]
- [<System.Runtime.CompilerServices.Nullable(1)>]
-
-
- [get: System.Runtime.CompilerServices.NullableContext(1)]
- [<get: System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.String
-
-
- The friendly name of the class that is derived from the event source.
- The friendly name of the derived class. The default is the simple name of the class.
- To be added.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.Void
-
-
-
-
-
- The arguments for the event.
- Called when the current event source is updated by the controller.
- To be added.
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1, 2 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1, 2 })>]
-
-
-
-
-
- The event source to send the command to.
- The event command to send.
- The arguments for the event command.
- Sends a command to a specified event source.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.Nullable(1)]
+ [<System.Runtime.CompilerServices.Nullable(1)>]
+
+
+ [get: System.Runtime.CompilerServices.NullableContext(1)]
+ [<get: System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.String
+
+
+ The friendly name of the class that is derived from the event source.
+ The friendly name of the derived class. The default is the simple name of the class.
+ To be added.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.Void
+
+
+
+
+
+ The arguments for the event.
+ Called when the current event source is updated by the controller.
+ To be added.
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1, 2 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 2, 1, 2 })>]
+
+
+
+
+
+ The event source to send the command to.
+ The event command to send.
+ The arguments for the event command.
+ Sends a command to a specified event source.
+
forwards the command to the callback. What the does with the command and its arguments is specific to the event source. The command and command arguments are passed to the callback of the specified event source. If possible, the current event source should not affect other event listeners' filtering events; however, that may not be possible if the command causes a garbage collection, a system flush, or some other global activity.
- ]]>
-
-
-
-
-
- System.Diagnostics.Tracing
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
-
-
- Sets the activity ID on the current thread.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
- The current thread's new activity ID, or to indicate that work on the current thread is not associated with any activity.
- Sets the activity ID on the current thread.
-
+ ]]>
+
+
+
+
+
+ System.Diagnostics.Tracing
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+
+
+ Sets the activity ID on the current thread.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+ The current thread's new activity ID, or to indicate that work on the current thread is not associated with any activity.
+ Sets the activity ID on the current thread.
+
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
- The current thread's new activity ID, or to indicate that work on the current thread is not associated with any activity.
- When this method returns, contains the previous activity ID on the current thread.
- Sets the activity ID on the current thread, and returns the previous activity ID.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ The current thread's new activity ID, or to indicate that work on the current thread is not associated with any activity.
+ When this method returns, contains the previous activity ID on the current thread.
+ Sets the activity ID on the current thread, and returns the previous activity ID.
+
method to temporarily overwrite the current thread's activity ID with a new activity ID. You must then restore the previous activity ID by passing the `oldActivityThatWillContinue` argument to the method.
- ]]>
-
-
-
-
-
-
-
-
-
-
- Property
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
- System.Diagnostics.Tracing.EventSourceSettings
-
-
- Gets the settings applied to this event source.
- The settings applied to this event source.
- To be added.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.String
-
-
-
- Obtains a string representation of the current event source instance.
- The name and unique identifier that identify the current event source.
- To be added.
-
-
-
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
-
-
- Writes an event.
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
- The name of the event to write.
- Writes an event without fields, but with the specified name and default options.
- To be added.
-
- is .
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
- The name of the event to write.
- The options such as level, keywords and operation code for the event.
- Writes an event without fields, but with the specified name and options.
- To be added.
-
- is .
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
- [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
- [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
- [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)>]
-
-
-
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(1)]
- [<System.Runtime.CompilerServices.Nullable(1)>]
-
-
-
-
-
- The type that defines the event and its associated data. This type must be an anonymous type or marked with the attribute.
- The name of the event.
- The event data. This type must be an anonymous type or marked with the attribute.
- Writes an event with the specified name and data.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Property
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+ System.Diagnostics.Tracing.EventSourceSettings
+
+
+ Gets the settings applied to this event source.
+ The settings applied to this event source.
+ To be added.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.String
+
+
+
+ Obtains a string representation of the current event source instance.
+ The name and unique identifier that identify the current event source.
+ To be added.
+
+
+
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+
+
+ Writes an event.
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+ The name of the event to write.
+ Writes an event without fields, but with the specified name and default options.
+ To be added.
+
+ is .
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ The name of the event to write.
+ The options such as level, keywords and operation code for the event.
+ Writes an event without fields, but with the specified name and options.
+ To be added.
+
+ is .
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+ [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
+ [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)>]
+
+
+
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(1)]
+ [<System.Runtime.CompilerServices.Nullable(1)>]
+
+
+
+
+
+ The type that defines the event and its associated data. This type must be an anonymous type or marked with the attribute.
+ The name of the event.
+ The event data. This type must be an anonymous type or marked with the attribute.
+ Writes an event with the specified name and data.
+
) or determined based on the name of type `T`. The public instance properties of `data` will be written recursively to create the event fields.
- ]]>
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
- [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
- [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
- [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)>]
-
-
-
-
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(1)]
- [<System.Runtime.CompilerServices.Nullable(1)>]
-
-
-
-
-
- The type that defines the event and its associated data. This type must be an anonymous type or marked with the attribute.
- The name of the event.
- The event options.
- The event data. This type must be an anonymous type or marked with the attribute.
- Writes an event with the specified name, event data and options.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+ [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
+ [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)>]
+
+
+
+
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(1)]
+ [<System.Runtime.CompilerServices.Nullable(1)>]
+
+
+
+
+
+ The type that defines the event and its associated data. This type must be an anonymous type or marked with the attribute.
+ The name of the event.
+ The event options.
+ The event data. This type must be an anonymous type or marked with the attribute.
+ Writes an event with the specified name, event data and options.
+
) or determined based on the name of type `T`. The public instance properties of `data` will be written recursively to create the event fields.
- ]]>
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
- [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
- [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
- [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)>]
-
-
-
-
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(1)]
- [<System.Runtime.CompilerServices.Nullable(1)>]
-
-
-
-
-
- The type that defines the event and its associated data. This type must be an anonymous type or marked with the attribute.
- The name of the event.
- The event options.
- The event data. This type must be an anonymous type or marked with the attribute.
- Writes an event with the specified name, options and event data.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+ [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
+ [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)>]
+
+
+
+
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(1)]
+ [<System.Runtime.CompilerServices.Nullable(1)>]
+
+
+
+
+
+ The type that defines the event and its associated data. This type must be an anonymous type or marked with the attribute.
+ The name of the event.
+ The event options.
+ The event data. This type must be an anonymous type or marked with the attribute.
+ Writes an event with the specified name, options and event data.
+
) or determined based on the name of type `T`. The public instance properties of `data` will be written recursively to create the event fields.
- ]]>
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
- [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
- [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
- [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)>]
-
-
-
-
-
-
-
-
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(1)]
- [<System.Runtime.CompilerServices.Nullable(1)>]
-
-
-
-
-
- The type that defines the event and its associated data. This type must be an anonymous type or marked with the attribute.
- The name of the event.
- The event options.
- The ID of the activity associated with the event.
- The ID of an associated activity, or if there is no associated activity.
- The event data. This type must be an anonymous type or marked with the attribute.
- Writes an event with the specified name, options, related activity and event data.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+ [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+ [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
+ [<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)>]
+
+
+
+
+
+
+
+
+
+
+
+
+ [System.Runtime.CompilerServices.Nullable(1)]
+ [<System.Runtime.CompilerServices.Nullable(1)>]
+
+
+
+
+
+ The type that defines the event and its associated data. This type must be an anonymous type or marked with the attribute.
+ The name of the event.
+ The event options.
+ The ID of the activity associated with the event.
+ The ID of an associated activity, or if there is no associated activity.
+ The event data. This type must be an anonymous type or marked with the attribute.
+ Writes an event with the specified name, options, related activity and event data.
+
) or determined based on the name of type `T`. The public instance properties of `data` will be written recursively to create the event fields.
- ]]>
-
-
-
-
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
-
-
- Writes an event by using the provided event identifier and optional arguments.
-
+ ]]>
+
+
+
+
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+
+
+ Writes an event by using the provided event identifier and optional arguments.
+
[!IMPORTANT]
> Event parameters with a type of `string` should not include `\0` characters. They are unsupported characters and can cause issues for parsers of the event payload.
- ]]>
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- Writes an event by using the provided event identifier.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ Writes an event by using the provided event identifier.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A byte array argument.
- Writes an event by using the provided event identifier and byte array argument.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A byte array argument.
+ Writes an event by using the provided event identifier and byte array argument.
+
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 8.0.0.0
-
-
- mscorlib
-
-
- netstandard
-
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- System.Void
-
-
-
-
-
-
- [System.ParamArray]
- [<System.ParamArray>]
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- The event source primitives.
- Writes an event by using the provided event identifier and a variable number of event source primitives.
- This is a varargs helper for writing an event. It does create an array and box all the arguments so it is relatively inefficient and should only be used for relatively rare events (for example, less than 100 per second). If your rates are faster than that, use to create fast helpers for your particular method signature. Even if you use this for rare events, this call should be guarded by an check so that the varargs call is not made when the EventSource isn't active.
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- An integer argument.
- Writes an event by using the provided event identifier and 32-bit integer argument.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 8.0.0.0
+
+
+ mscorlib
+
+
+ netstandard
+
+
+
+ [System.Runtime.CompilerServices.NullableContext(1)]
+ [<System.Runtime.CompilerServices.NullableContext(1)>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ [System.ParamArray]
+ [<System.ParamArray>]
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ The event source primitives.
+ Writes an event by using the provided event identifier and a variable number of event source primitives.
+ This is a varargs helper for writing an event. It does create an array and box all the arguments so it is relatively inefficient and should only be used for relatively rare events (for example, less than 100 per second). If your rates are faster than that, use to create fast helpers for your particular method signature. Even if you use this for rare events, this call should be guarded by an check so that the varargs call is not made when the EventSource isn't active.
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ An integer argument.
+ Writes an event by using the provided event identifier and 32-bit integer argument.
+
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A 64 bit integer argument.
- Writes an event by using the provided event identifier and 64-bit integer argument.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A 64 bit integer argument.
+ Writes an event by using the provided event identifier and 64-bit integer argument.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
- [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
- [System.ParamArray]
- [<System.ParamArray>]
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 1, 2 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 1, 2 })>]
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- An array of objects.
- Writes an event by using the provided event identifier and array of arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+ [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ [System.ParamArray]
+ [<System.ParamArray>]
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 1, 2 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 1, 2 })>]
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ An array of objects.
+ Writes an event by using the provided event identifier and array of arguments.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A string argument.
- Writes an event by using the provided event identifier and string argument.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A string argument.
+ Writes an event by using the provided event identifier and string argument.
+
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- An integer argument.
- An integer argument.
- Writes an event by using the provided event identifier and 32-bit integer arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ An integer argument.
+ An integer argument.
+ Writes an event by using the provided event identifier and 32-bit integer arguments.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A 32-bit integer argument.
- A string argument.
- Writes an event by using the provided event identifier and 32-bit integer and string arguments.
- To be added.
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A 64-bit integer argument.
- A byte array argument.
- Writes the event data using the specified identifier and 64-bit integer and byte array arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A 32-bit integer argument.
+ A string argument.
+ Writes an event by using the provided event identifier and 32-bit integer and string arguments.
+ To be added.
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A 64-bit integer argument.
+ A byte array argument.
+ Writes the event data using the specified identifier and 64-bit integer and byte array arguments.
+
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A 64 bit integer argument.
- A 64 bit integer argument.
- Writes an event by using the provided event identifier and 64-bit arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A 64 bit integer argument.
+ A 64 bit integer argument.
+ Writes an event by using the provided event identifier and 64-bit arguments.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A 64-bit integer argument.
- A string argument.
- Writes an event by using the provided event identifier and 64-bit integer, and string arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A 64-bit integer argument.
+ A string argument.
+ Writes an event by using the provided event identifier and 64-bit integer, and string arguments.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A string argument.
- A 32 bit integer argument.
- Writes an event by using the provided event identifier and arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A string argument.
+ A 32 bit integer argument.
+ Writes an event by using the provided event identifier and arguments.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A string argument.
- A 64 bit integer argument.
- Writes an event by using the provided event identifier and arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A string argument.
+ A 64 bit integer argument.
+ Writes an event by using the provided event identifier and arguments.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A string argument.
- A string argument.
- Writes an event by using the provided event identifier and string arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A string argument.
+ A string argument.
+ Writes an event by using the provided event identifier and string arguments.
+
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- An integer argument.
- An integer argument.
- An integer argument.
- Writes an event by using the provided event identifier and 32-bit integer arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ An integer argument.
+ An integer argument.
+ An integer argument.
+ Writes an event by using the provided event identifier and 32-bit integer arguments.
+
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A 64 bit integer argument.
- A 64 bit integer argument.
- A 64 bit integer argument.
- Writes an event by using the provided event identifier and 64-bit arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A 64 bit integer argument.
+ A 64 bit integer argument.
+ A 64 bit integer argument.
+ Writes an event by using the provided event identifier and 64-bit arguments.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A string argument.
- A 32 bit integer argument.
- A 32 bit integer argument.
- Writes an event by using the provided event identifier and arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A string argument.
+ A 32 bit integer argument.
+ A 32 bit integer argument.
+ Writes an event by using the provided event identifier and arguments.
+
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
-
- The event identifier. This value should be between 0 and 65535.
- A string argument.
- A string argument.
- A string argument.
- Writes an event by using the provided event identifier and string arguments.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ The event identifier. This value should be between 0 and 65535.
+ A string argument.
+ A string argument.
+ A string argument.
+ Writes an event by using the provided event identifier and string arguments.
+
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.0.0
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.CLSCompliant(false)]
- [<System.CLSCompliant(false)>]
-
-
- [System.Security.SecurityCritical]
- [<System.Security.SecurityCritical>]
-
-
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
- [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
-
-
- [System.Runtime.CompilerServices.NullableContext(0)]
- [<System.Runtime.CompilerServices.NullableContext(0)>]
-
-
-
- System.Void
-
-
-
-
-
-
-
- The event identifier.
- The number of event data items.
- The structure that contains the event data.
- Creates a new overload by using the provided event identifier and event data.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.0.0
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.CLSCompliant(false)]
+ [<System.CLSCompliant(false)>]
+
+
+ [System.Security.SecurityCritical]
+ [<System.Security.SecurityCritical>]
+
+
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+ [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
+
+
+ [System.Runtime.CompilerServices.NullableContext(0)]
+ [<System.Runtime.CompilerServices.NullableContext(0)>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+ The event identifier.
+ The number of event data items.
+ The structure that contains the event data.
+ Creates a new overload by using the provided event identifier and event data.
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
- [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
-
-
- [System.Security.SecuritySafeCritical]
- [<System.Security.SecuritySafeCritical>]
-
-
-
- System.Void
-
-
-
-
-
-
-
-
- [System.ParamArray]
- [<System.ParamArray>]
-
-
- [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 1, 2 })]
- [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 1, 2 })>]
-
-
-
-
-
- An identifier that uniquely identifies this event within the .
- The related activity identifier.
- The related activity identifier.
- An array of objects that contain data about the event.
- Writes an event that indicates that the current activity is related to another activity.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+ [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
+
+
+ [System.Security.SecuritySafeCritical]
+ [<System.Security.SecuritySafeCritical>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ [System.ParamArray]
+ [<System.ParamArray>]
+
+
+ [System.Runtime.CompilerServices.Nullable(new System.Byte[] { 1, 2 })]
+ [<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 1, 2 })>]
+
+
+
+
+
+ An identifier that uniquely identifies this event within the .
+ The related activity identifier.
+ The related activity identifier.
+ An array of objects that contain data about the event.
+ Writes an event that indicates that the current activity is related to another activity.
+
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method
-
- System.Diagnostics.Tracing
- 4.0.10.0
- 4.0.20.0
- 4.1.0.0
- 4.2.0.0
- 4.2.1.0
- 4.2.2.0
- 5.0.0.0
- 6.0.0.0
- 7.0.0.0
- 8.0.0.0
-
-
- mscorlib
- 2.0.5.0
- 4.0.0.0
-
-
- netstandard
- 2.0.0.0
- 2.1.0.0
-
-
-
- [System.CLSCompliant(false)]
- [<System.CLSCompliant(false)>]
-
-
- [System.Security.SecurityCritical]
- [<System.Security.SecurityCritical>]
-
-
- [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
- [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
-
-
- [System.Runtime.CompilerServices.NullableContext(0)]
- [<System.Runtime.CompilerServices.NullableContext(0)>]
-
-
-
- System.Void
-
-
-
-
-
-
-
-
-
- An identifier that uniquely identifies this event within the .
- A pointer to the GUID of the related activity ID.
- A pointer to the GUID of the related activity ID.
- The number of items in the field.
- A pointer to the first item in the event data field.
- Writes an event that indicates that the current activity is related to another activity.
-
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ System.Diagnostics.Tracing
+ 4.0.10.0
+ 4.0.20.0
+ 4.1.0.0
+ 4.2.0.0
+ 4.2.1.0
+ 4.2.2.0
+ 5.0.0.0
+ 6.0.0.0
+ 7.0.0.0
+ 8.0.0.0
+
+
+ mscorlib
+ 2.0.5.0
+ 4.0.0.0
+
+
+ netstandard
+ 2.0.0.0
+ 2.1.0.0
+
+
+
+ [System.CLSCompliant(false)]
+ [<System.CLSCompliant(false)>]
+
+
+ [System.Security.SecurityCritical]
+ [<System.Security.SecurityCritical>]
+
+
+ [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")]
+ [<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("EventSource will serialize the whole object graph. Trimmer will not safely handle this case because properties may be trimmed. This can be suppressed if the object is a primitive type")>]
+
+
+ [System.Runtime.CompilerServices.NullableContext(0)]
+ [<System.Runtime.CompilerServices.NullableContext(0)>]
+
+
+
+ System.Void
+
+
+
+
+
+
+
+
+
+ An identifier that uniquely identifies this event within the .
+ A pointer to the GUID of the related activity ID.
+ A pointer to the GUID of the related activity ID.
+ The number of items in the field.
+ A pointer to the first item in the event data field.
+ Writes an event that indicates that the current activity is related to another activity.
+
-
-
-
-
-
+ ]]>
+
+
+
+
+
diff --git a/xml/System.Diagnostics.Tracing/EventWrittenEventArgs.xml b/xml/System.Diagnostics.Tracing/EventWrittenEventArgs.xml
index dcf4fea18f5..da38951c688 100644
--- a/xml/System.Diagnostics.Tracing/EventWrittenEventArgs.xml
+++ b/xml/System.Diagnostics.Tracing/EventWrittenEventArgs.xml
@@ -54,29 +54,7 @@
Provides data for the callback.
-
- , the callback method is invoked. It is passed an `EventWrittenEventArgs` instance that contains information associated with the event. All property values of the `EventWrittenEventArgs` class are valid only during the callback.
-
-The following sections contain additional information about individual `EventWrittenEventArgs` properties.
-
-### ActivityId property
-
-When using and its derived classes, threads can be marked as having an activity associated with them. The `ActivityId` property returns the activity ID of the thread that logged the event. Note that threads do not have to have an activity, in which case this property returns .
-
-### OSThreadId and TimeStamp properties
-
-Starting with .NET Core 2.2, objects can subscribe to native runtime events (such as GC, JIT, and threadpool events) in addition to events emitted by objects. In previous versions of .NET Core and all versions of .NET Framework, the thread ID and timestamp can be gathered from the environment, because they are dispatched synchronously on the same thread that emitted them. Not all native runtime events can be dispatched synchronously, however. Some events, such as GC events, are emitted when managed thread execution is suspended. These events are buffered in native code and are dispatched by a dispatcher thread once managed code can execute again. Because these events are buffered, the environment cannot be used to reliably retrieve the thread ID and timestamp. Because of this, starting with .NET Core 2.2, thread ID and timestamp information are available as members of the `EventWrittenEventArgs` class.
-
-### RelatedActivityId property
-
- A related activity is an activity that is strongly related to the current one. Typically, it is either the activity that caused the current activity (events with the `Start` opcode typically do this) or an activity that was created by the current one (events with the `Send` opcode typically do this). When it is used, the `RelatedActivityID` is explicitly passed by the method doing the logging. Many events don't pass a `RelatedActivityId`, in which case this property returns .
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for EventWrittenEventArgs.
diff --git a/xml/System.Diagnostics/PerformanceCounterType.xml b/xml/System.Diagnostics/PerformanceCounterType.xml
index 3698b4aea35..8deed4ad992 100644
--- a/xml/System.Diagnostics/PerformanceCounterType.xml
+++ b/xml/System.Diagnostics/PerformanceCounterType.xml
@@ -32,151 +32,7 @@
Specifies performance counter types that map directly to native types.
-
- [!NOTE]
-> Unless otherwise indicated, the time base is seconds.
-
- When instrumenting applications (creating and writing custom performance counters), you might be working with performance counter types that rely on an accompanying base counter that is used in the calculations. The base counter must be immediately after its associated counter in the collection your application uses. The following table lists the base counter types with their corresponding performance counter types.
-
-|Base counter type|Performance counter types|
-|-----------------------|-------------------------------|
-|`AverageBase`|`AverageTimer32`
`AverageCount64`|
-|`CounterMultiBase`|`CounterMultiTimer`
`CounterMultiTimerInverse`
`CounterMultiTimer100Ns`
`CounterMultiTimer100NsInverse`|
-|`RawBase`|`RawFraction`|
-|`SampleBase`|`SampleFraction`|
-
-The following are the formulas used by some of the counters that represent calculated values:
-
-- `AverageCount64`: (N1 - N0)/(B1 - B0), where N 1 and N 0 are performance counter readings, and B1 and B0 are their corresponding `AverageBase` values. Thus, the numerator represents the numbers of items processed during the sample interval, and the denominator represents the number of operations completed during the sample interval.
-
-- `AverageTimer32`: ((N1 - N0)/F)/(B1 - B0), where N1 and N0 are performance counter readings, B1 and B0 are their corresponding `AverageBase` values, and F is the number of ticks per second. The value of F is factored into the equation so that the result can be displayed in seconds. Thus, the numerator represents the numbers of ticks counted during the last sample interval, F represents the frequency of the ticks, and the denominator represents the number of operations completed during the last sample interval.
-
-- `CounterDelta32`: N1 - N0, where N1 and N0 are performance counter readings.
-
-- `CounterDelta64`: N1 - N0, where N1 and N0 are performance counter readings.
-
-- `CounterMultiTimer`: ((N1 - N0) / (D1 - D0)) x 100 / B, where N1 and N0 are performance counter readings, D1 and D0 are their corresponding time readings in ticks of the system performance timer, and the variable B denotes the base count for the monitored components (using a base counter of type `CounterMultiBase`). Thus, the numerator represents the portions of the sample interval during which the monitored components were active, and the denominator represents the total elapsed time of the sample interval.
-
-- `CounterMultiTimer100Ns`: ((N1 - N0) / (D1 - D0)) x 100 / B, where N1 and N0 are performance counter readings, D1 and D0 are their corresponding time readings in 100-nanosecond units, and the variable B denotes the base count for the monitored components (using a base counter of type `CounterMultiBase`). Thus, the numerator represents the portions of the sample interval during which the monitored components were active, and the denominator represents the total elapsed time of the sample interval.
-
-- `CounterMultiTimer100NsInverse`: (B - ((N1 - N0) / (D1 - D0))) x 100, where the denominator represents the total elapsed time of the sample interval, the numerator represents the time during the interval when monitored components were inactive, and B represents the number of components being monitored, using a base counter of type `CounterMultiBase`.
-
-- `CounterMultiTimerInverse`: (B- ((N1 - N0) / (D1 - D0))) x 100, where the denominator represents the total elapsed time of the sample interval, the numerator represents the time during the interval when monitored components were inactive, and B represents the number of components being monitored, using a base counter of type `CounterMultiBase`.
-
-- `CounterTimer`: (N1 - N0) / (D1 - D0), where N1 and N0 are performance counter readings, and D1 and D0 are their corresponding time readings. Thus, the numerator represents the portions of the sample interval during which the monitored components were active, and the denominator represents the total elapsed time of the sample interval.
-
-- `CounterTimerInverse`: (1- ((N1 - N0) / (D1 - D0))) x 100, where the numerator represents the time during the interval when the monitored components were inactive, and the denominator represents the total elapsed time of the sample interval.
-
-- `CountPerTimeInterval32`: (N1 - N0) / (D1 - D0), where the numerator represents the number of items in the queue, and the denominator represents the time elapsed during the last sample interval.
-
-- `CountPerTimeInterval64`: (N1 - N0) / (D1 - D0), where the numerator represents the number of items in a queue and the denominator represents the time elapsed during the sample interval.
-
-- `ElapsedTime`: (D0 - N0) / F, where D0 represents the current time, N0 represents the time the object was started, and F represents the number of time units that elapse in one second. The value of F is factored into the equation so that the result can be displayed in seconds.
-
-- `NumberOfItems32`: None. Does not display an average, but shows the raw data as it is collected.
-
-- `NumberOfItems64`: None. Does not display an average, but shows the raw data as it is collected.
-
-- `NumberOfItemsHEX32`: None. Does not display an average, but shows the raw data as it is collected.
-
-- `NumberOfItemsHEX64`: None. Does not display an average, but shows the raw data as it is collected
-
-- `RateOfCountsPerSecond32`: (N1 - N0) / ((D1 - D0) / F), where N1 and N0 are performance counter readings, D1 and D0 are their corresponding time readings, and F represents the number of ticks per second. Thus, the numerator represents the number of operations performed during the last sample interval, the denominator represents the number of ticks elapsed during the last sample interval, and F is the frequency of the ticks. The value of F is factored into the equation so that the result can be displayed in seconds.
-
-- `RateOfCountsPerSecond64`: (N1 - N0) / ((D1 - D0) / F), where N1 and N0 are performance counter readings, D1 and D0 are their corresponding time readings, and F represents the number of ticks per second. Thus, the numerator represents the number of operations performed during the last sample interval, the denominator represents the number of ticks elapsed during the last sample interval, and F is the frequency of the ticks. The value of F is factored into the equation so that the result can be displayed in seconds.
-
-- `RawFraction`: (N0 / D0) x 100, where D0 represents a measured attribute (using a base counter of type `RawBase`) and N0 represents one component of that attribute.
-
-- `SampleCounter`: (N1 - N0) / ((D1 - D0) / F), where the numerator (N) represents the number of operations completed, the denominator (D) represents elapsed time in units of ticks of the system performance timer, and F represents the number of ticks that elapse in one second. F is factored into the equation so that the result can be displayed in seconds.
-
-- `SampleFraction`: ((N1 - N0) / (D1 - D0)) x 100, where the numerator represents the number of successful operations during the last sample interval, and the denominator represents the change in the number of all operations (of the type measured) completed during the sample interval, using counters of type `SampleBase`.
-
-- `Timer100Ns`: (N1 - N0) / (D1 - D0) x 100, where the numerator represents the portions of the sample interval during which the monitored components were active, and the denominator represents the total elapsed time of the sample interval.
-
-- `Timer100NsInverse`: (1- ((N1 - N0) / (D1 - D0))) x 100, where the numerator represents the time during the interval when the monitored components were inactive, and the denominator represents the total elapsed time of the sample interval.
-
-## Examples
- The following examples demonstrate several of the counter types in the enumeration.
-
-### AverageCount64
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/CounterCreationData/Overview/averagecount32.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/VB/averagecount32.vb" id="Snippet1":::
-
-### AverageTimer32
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageTimer32/CPP/averagetimer32.cpp" id="Snippet2":::
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/averagetimer32.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.AverageTimer32/VB/averagetimer32.vb" id="Snippet2":::
-
-### ElapsedTime
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp" id="Snippet2":::
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounter/NextValue/elapsedtime.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/VB/elapsedtime.vb" id="Snippet2":::
-
-### NumberOfItems32
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.NumberOfItems32/CPP/numberofitems32.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/numberofitems32.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.NumberOfItems32/VB/numberofitems32.vb" id="Snippet1":::
-
-### NumberOfItems64
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.NumberOfItems64/CPP/numberofitems64.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/numberofitems64.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.NumberOfItems64/VB/numberofitems64.vb" id="Snippet1":::
-
-### SampleFraction
-
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.SampleFraction/VB/program.vb" id="Snippet1":::
-
-### RateOfCountsPerSecond32
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.RateOfCountsPerSecond/CPP/rateofcountspersecond32.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rateofcountspersecond32.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.RateOfCountsPerSecond/VB/rateofcountspersecond32.vb" id="Snippet1":::
-
-### RateOfCountsPerSecond64
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.RateOfCountsPerSecond64/CPP/rateofcountspersecond64.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rateofcountspersecond64.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.RateOfCountsPerSecond64/VB/rateofcountspersecond64.vb" id="Snippet1":::
-
-### RawFraction
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.RawFraction/CPP/rawfraction.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.Diagnostics/PerformanceCounterType/Overview/rawfraction.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/PerformanceCounterType.RawFraction/VB/rawfraction.vb" id="Snippet1":::
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for PerformanceCounterType.
diff --git a/xml/System.Drawing.Drawing2D/Matrix.xml b/xml/System.Drawing.Drawing2D/Matrix.xml
index 95de521b2a8..031e8f39275 100644
--- a/xml/System.Drawing.Drawing2D/Matrix.xml
+++ b/xml/System.Drawing.Drawing2D/Matrix.xml
@@ -42,51 +42,7 @@
Encapsulates a 3-by-3 affine matrix that represents a geometric transform. This class cannot be inherited.
-
- object. Because the third column of a matrix that represents an affine transformation is always (0, 0, 1), you specify only the six numbers in the first two columns when you construct a object. The statement `Matrix myMatrix = new Matrix(0, 1, -1, 0, 3, 4)` constructs the matrix shown in the following figure.
-
- 
-
-[!INCLUDE[System.Drawing.Common note](~/includes/system-drawing-common.md)]
-
-## Composite Transformations
-
-A composite transformation is a sequence of transformations, one followed by the other. Consider the matrices and transformations in the following list:
-
-|||
-|-|-|
-|Matrix A|Rotate 90 degrees|
-|Matrix B|Scale by a factor of 2 in the x direction|
-|Matrix C|Translate 3 units in the y direction|
-
- If we start with the point (2, 1) - represented by the matrix [2 1 1] - and multiply by A, then B, then C, the point (2, 1) will undergo the three transformations in the order listed.
-
- [2 1 1]ABC = [-2 5 1]
-
- Rather than store the three parts of the composite transformation in three separate matrices, you can multiply A, B, and C together to get a single 3×3 matrix that stores the entire composite transformation. Suppose ABC = D. Then a point multiplied by D gives the same result as a point multiplied by A, then B, then C.
-
- [2 1 1]D = [-2 5 1]
-
- The following illustration shows the matrices A, B, C, and D.
-
- 
-
- The fact that the matrix of a composite transformation can be formed by multiplying the individual transformation matrices means that any sequence of affine transformations can be stored in a single object.
-
-> [!CAUTION]
-> The order of a composite transformation is important. In general, rotate, then scale, then translate is not the same as scale, then rotate, then translate. Similarly, the order of matrix multiplication is important. In general, ABC is not the same as BAC.
-
- The class provides several methods for building a composite transformation: , , , , , and . The following example creates the matrix of a composite transformation that first rotates 30 degrees, then scales by a factor of 2 in the y direction, and then translates 5 units in the x direction:
-
- :::code language="csharp" source="~/snippets/csharp/System.Drawing.Drawing2D/Matrix/Overview/Class1.cs" id="Snippet11":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Drawing.CoordinateSystems/VB/Class1.vb" id="Snippet11":::
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for Matrix.
Coordinate Systems and Transformations
diff --git a/xml/System.Dynamic/ExpandoObject.xml b/xml/System.Dynamic/ExpandoObject.xml
index 7f27fcbfddd..130ee72793f 100644
--- a/xml/System.Dynamic/ExpandoObject.xml
+++ b/xml/System.Dynamic/ExpandoObject.xml
@@ -79,129 +79,7 @@
Represents an object whose members can be dynamically added and removed at run time.
-
- , which enables you to share instances of the `ExpandoObject` class between languages that support the DLR interoperability model. For example, you can create an instance of the `ExpandoObject` class in C# and then pass it to an IronPython function. For more information, see [Dynamic Language Runtime Overview](/dotnet/framework/reflection-and-codedom/dynamic-language-runtime-overview) and [Introducing the ExpandoObject](https://go.microsoft.com/fwlink/?LinkID=169157) on the C# Frequently Asked Questions Web site.
-
- The `ExpandoObject` class is an implementation of the dynamic object concept that enables getting, setting, and invoking members. If you want to define types that have their own dynamic dispatch semantics, use the class. If you want to define how dynamic objects participate in the interoperability protocol and manage DLR fast dynamic dispatch caching, create your own implementation of the interface.
-
-## Creating an Instance
- In C#, to enable late binding for an instance of the `ExpandoObject` class, you must use the `dynamic` keyword. For more information, see [Using Type dynamic](/dotnet/csharp/programming-guide/types/using-type-dynamic).
-
- In Visual Basic, dynamic operations are supported by late binding. For more information, see [Early and Late Binding (Visual Basic)](/dotnet/visual-basic/programming-guide/language-features/early-late-binding/).
-
- The following code example demonstrates how to create an instance of the `ExpandoObject` class.
-
- :::code language="csharp" source="~/snippets/csharp/System.Dynamic/ExpandoObject/Overview/program.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.dynamic.expandoobject/vb/module1.vb" id="Snippet1":::
-
-## Adding New Members
- You can add properties, methods, and events to instances of the `ExpandoObject` class.
-
- The following code example demonstrates how to add a new property to an instance of the `ExpandoObject` class.
-
- :::code language="csharp" source="~/snippets/csharp/System.Dynamic/ExpandoObject/Overview/program.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.dynamic.expandoobject/vb/module1.vb" id="Snippet2":::
-
- The methods represent lambda expressions that are stored as delegates, which can be invoked when they are needed. The following code example demonstrates how to add a method that increments a value of the dynamic property.
-
- :::code language="csharp" source="~/snippets/csharp/System.Dynamic/ExpandoObject/Overview/program.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.dynamic.expandoobject/vb/module1.vb" id="Snippet3":::
-
- The following code example demonstrates how to add an event to an instance of the `ExpandoObject` class.
-
-```csharp
-class Program
-{
- static void Main(string[] args)
- {
- dynamic sampleObject = new ExpandoObject();
-
- // Create a new event and initialize it with null.
- sampleObject.sampleEvent = null;
-
- // Add an event handler.
- sampleObject.sampleEvent += new EventHandler(SampleHandler);
-
- // Raise an event for testing purposes.
- sampleObject.sampleEvent(sampleObject, new EventArgs());
- }
-
- // Event handler.
- static void SampleHandler(object sender, EventArgs e)
- {
- Console.WriteLine("SampleHandler for {0} event", sender);
- }
-}
-// This code example produces the following output:
-// SampleHandler for System.Dynamic.ExpandoObject event.
-```
-
-```vb
-Module Module1
-
-Sub Main()
- Dim sampleObject As Object = New ExpandoObject()
-
- ' Create a new event and initialize it with null.
- sampleObject.sampleEvent = Nothing
-
- ' Add an event handler.
- Dim handler As EventHandler = AddressOf SampleHandler
- sampleObject.sampleEvent =
- [Delegate].Combine(sampleObject.sampleEvent, handler)
-
- ' Raise an event for testing purposes.
- sampleObject.sampleEvent.Invoke(sampleObject, New EventArgs())
-
-End Sub
-
-' Event handler.
-Sub SampleHandler(ByVal sender As Object, ByVal e As EventArgs)
- Console.WriteLine("SampleHandler for {0} event", sender)
-End Sub
-
-' This code example produces the following output:
-' SampleHandler for System.Dynamic.ExpandoObject event.
-
-End Module
-```
-
-## Passing As a Parameter
- You can pass instances of the `ExpandoObject` class as parameters. Note that these instances are treated as dynamic objects in C# and late-bound objects in Visual Basic. This means that you do not have IntelliSense for object members and you do not receive compiler errors when you call non-existent members. If you call a member that does not exist, an exception occurs.
-
- The following code example demonstrates how you can create and use a method to print the names and values of properties.
-
- :::code language="csharp" source="~/snippets/csharp/System.Dynamic/ExpandoObject/Overview/program.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.dynamic.expandoobject/vb/module1.vb" id="Snippet4":::
-
-## Enumerating and Deleting Members
- The `ExpandoObject` class implements the `IDictionary` interface. This enables enumeration of members added to the instance of the `ExpandoObject` class at run time. This can be useful if you do not know at compile time what members an instance might have.
-
- The following code example shows how you can cast an instance of the `ExpandoObject` class to the interface and enumerate the instance's members.
-
- :::code language="csharp" source="~/snippets/csharp/System.Dynamic/ExpandoObject/Overview/program.cs" id="Snippet5":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.dynamic.expandoobject/vb/module1.vb" id="Snippet5":::
-
- In languages that do not have syntax for deleting members (such as C# and Visual Basic), you can delete a member by implicitly casting an instance of the `ExpandoObject` to the `IDictionary` interface and then deleting the member as a key/value pair. This is shown in the following example.
-
- :::code language="csharp" source="~/snippets/csharp/System.Dynamic/ExpandoObject/Overview/program.cs" id="Snippet6":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.dynamic.expandoobject/vb/module1.vb" id="Snippet6":::
-
-## Receiving Notifications of Property Changes
- The `ExpandoObject` class implements the interface and can raise a event when a member is added, deleted, or modified. This enables `ExpandoObject` class integration with Windows Presentation Foundation (WPF) data binding and other environments that require notification about changes in the object content.
-
- The following code example demonstrates how to create an event handler for the `PropertyChanged` event.
-
- :::code language="csharp" source="~/snippets/csharp/System.Dynamic/ExpandoObject/Overview/program.cs" id="Snippet7":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.dynamic.expandoobject/vb/module1.vb" id="Snippet7":::
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for ExpandoObject.
diff --git a/xml/System.Globalization/CompareInfo.xml b/xml/System.Globalization/CompareInfo.xml
index 6c3319dd4f4..526c2afbfd3 100644
--- a/xml/System.Globalization/CompareInfo.xml
+++ b/xml/System.Globalization/CompareInfo.xml
@@ -92,7 +92,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/CompareInfo/VB/CompareInfo.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.CompareInfo class.
+ For more information about this API, see Supplemental API remarks for CompareInfo.
Sorting Weight Tables for Windows operating systems
Default Unicode Collation Element Table, for Linux and macOS
diff --git a/xml/System.Globalization/CompareOptions.xml b/xml/System.Globalization/CompareOptions.xml
index 2e542820c86..2fee02b069d 100644
--- a/xml/System.Globalization/CompareOptions.xml
+++ b/xml/System.Globalization/CompareOptions.xml
@@ -74,7 +74,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CompareOptions.StringSort/VB/compareoptions_stringsort.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.CompareOptions enum.
+ For more information about this API, see Supplemental API remarks for CompareOptions.
Basic String Operations in .NET
diff --git a/xml/System.Globalization/CultureAndRegionInfoBuilder.xml b/xml/System.Globalization/CultureAndRegionInfoBuilder.xml
index 071f78312e4..e19036d02c6 100644
--- a/xml/System.Globalization/CultureAndRegionInfoBuilder.xml
+++ b/xml/System.Globalization/CultureAndRegionInfoBuilder.xml
@@ -29,7 +29,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.globalization.cultureandregioninfobuilder.class/vb/car.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.CultureAndRegionInfoBuilder class.
+ For more information about this API, see Supplemental API remarks for CultureAndRegionInfoBuilder.
diff --git a/xml/System.Globalization/CultureInfo.xml b/xml/System.Globalization/CultureInfo.xml
index 7dea07e0754..25a63e0fe35 100644
--- a/xml/System.Globalization/CultureInfo.xml
+++ b/xml/System.Globalization/CultureInfo.xml
@@ -93,7 +93,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/VB/spanishspain.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.CultureInfo class.
+ For more information about this API, see Supplemental API remarks for CultureInfo.
diff --git a/xml/System.Globalization/DateTimeFormatInfo.xml b/xml/System.Globalization/DateTimeFormatInfo.xml
index 754ac39b840..6d0bf1a8d8c 100644
--- a/xml/System.Globalization/DateTimeFormatInfo.xml
+++ b/xml/System.Globalization/DateTimeFormatInfo.xml
@@ -98,7 +98,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.globalization.datetimeformatinfo.class/vb/format1.vb" id="Snippet5":::
]]>
- For more information about this API, see System.Globalization.DateTimeFormatInfo class.
+ For more information about this API, see Supplemental API remarks for DateTimeFormatInfo.
diff --git a/xml/System.Globalization/NumberFormatInfo.xml b/xml/System.Globalization/NumberFormatInfo.xml
index f1d5b3afb74..d363ba03925 100644
--- a/xml/System.Globalization/NumberFormatInfo.xml
+++ b/xml/System.Globalization/NumberFormatInfo.xml
@@ -91,7 +91,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/NumberFormatInfo/vb/numberformatinfo.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.NumberFormatInfo class.
+ For more information about this API, see Supplemental API remarks for NumberFormatInfo.
Custom Numeric Format Strings
diff --git a/xml/System.Globalization/PersianCalendar.xml b/xml/System.Globalization/PersianCalendar.xml
index 15f78f94f29..d661e6127bc 100644
--- a/xml/System.Globalization/PersianCalendar.xml
+++ b/xml/System.Globalization/PersianCalendar.xml
@@ -78,7 +78,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/sys.glob.persianCal/vb/pcal.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.PersianCalendar class.
+ For more information about this API, see Supplemental API remarks for PersianCalendar.
diff --git a/xml/System.Globalization/RegionInfo.xml b/xml/System.Globalization/RegionInfo.xml
index 3418cc38d1c..24bee26e5c7 100644
--- a/xml/System.Globalization/RegionInfo.xml
+++ b/xml/System.Globalization/RegionInfo.xml
@@ -80,7 +80,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.RegionInfo/VB/regioninfo.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.RegionInfo class.
+ For more information about this API, see Supplemental API remarks for RegionInfo.
diff --git a/xml/System.Globalization/SortKey.xml b/xml/System.Globalization/SortKey.xml
index 6ceb5ddcdfe..b9ea6017721 100644
--- a/xml/System.Globalization/SortKey.xml
+++ b/xml/System.Globalization/SortKey.xml
@@ -77,7 +77,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.globalization.sortkey.class/vb/sortkey1.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.SortKey class.
+ For more information about this API, see Supplemental API remarks for SortKey.
diff --git a/xml/System.Globalization/SortVersion.xml b/xml/System.Globalization/SortVersion.xml
index 058b9da4ae5..ffbcc4518ee 100644
--- a/xml/System.Globalization/SortVersion.xml
+++ b/xml/System.Globalization/SortVersion.xml
@@ -63,7 +63,7 @@
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.globalization.sortversion/vb/example1.vb" id="Snippet1":::
]]>
- For more information about this API, see System.Globalization.SortVersion class.
+ For more information about this API, see Supplemental API remarks for SortVersion.
diff --git a/xml/System.IO/FileStream.xml b/xml/System.IO/FileStream.xml
index 35dbcfed5ca..e4758c2db01 100644
--- a/xml/System.IO/FileStream.xml
+++ b/xml/System.IO/FileStream.xml
@@ -66,54 +66,22 @@
Provides a for a file, supporting both synchronous and asynchronous read and write operations.
-
- class to read from, write to, open, and close files on a file system, and to manipulate other file-related operating system handles, including pipes, standard input, and standard output. You can use the , , , and methods to perform synchronous operations, or the , , , and methods to perform asynchronous operations. Use the asynchronous methods to perform resource-intensive file operations without blocking the main thread. This performance consideration is particularly important in a Windows 8.x Store app or desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. buffers input and output for better performance.
-
-> [!IMPORTANT]
-> This type implements the interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its method in a `try`/`catch` block. To dispose of it indirectly, use a language construct such as `using` (in C#) or `Using` (in Visual Basic). For more information, see the "Using an Object that Implements IDisposable" section in the interface topic.
-
- The property detects whether the file handle was opened asynchronously. You specify this value when you create an instance of the class using a constructor that has an `isAsync`, `useAsync`, or `options` parameter. When the property is `true`, the stream utilizes overlapped I/O to perform file operations asynchronously. However, the property does not have to be `true` to call the , , or method. When the property is `false` and you call the asynchronous read and write operations, the UI thread is still not blocked, but the actual I/O operation is performed synchronously.
-
- The method supports random access to files. allows the read/write position to be moved to any position within the file. This is done with byte offset reference point parameters. The byte offset is relative to the seek reference point, which can be the beginning, the current position, or the end of the underlying file, as represented by the three members of the enumeration.
-
-> [!NOTE]
-> Disk files always support random access. At the time of construction, the property value is set to `true` or `false` depending on the underlying file type. If the underlying file type is FILE_TYPE_DISK, as defined in winbase.h, the property value is `true`. Otherwise, the property value is `false`.
-
- If a process terminates with part of a file locked or closes a file that has outstanding locks, the behavior is undefined.
-
- For directory operations and other file operations, see the , , and classes. The class is a utility class that has static methods primarily for the creation of objects based on file paths. The class creates a stream from a byte array and is similar to the class.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
-## Detection of Stream Position Changes
- When a object does not have an exclusive hold on its handle, another thread could access the file handle concurrently and change the position of the operating system's file pointer that is associated with the file handle. In this case, the cached position in the object and the cached data in the buffer could be compromised. The object routinely performs checks on methods that access the cached buffer to ensure that the operating system's handle position is the same as the cached position used by the object.
-
- If an unexpected change in the handle position is detected in a call to the method, the .NET Framework discards the contents of the buffer and reads the stream from the file again. This can affect performance, depending on the size of the file and any other processes that could affect the position of the file stream.
-
- If an unexpected change in the handle position is detected in a call to the method, the contents of the buffer are discarded and an exception is thrown.
-
- A object will not have an exclusive hold on its handle when either the property is accessed to expose the handle or the object is given the property in its constructor.
-
-
-
-## Examples
- The following example demonstrates some of the constructors.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/Overview/fstream class.cs" id="Snippet1":::
- :::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/Overview/fstream class.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FStream Class/VB/fstream class.vb" id="Snippet1":::
-
- The following example shows how to write to a file asynchronously. This code runs in a WPF app that has a TextBlock named UserInput and a button hooked up to a Click event handler that is named Button_Click. The file path needs to be changed to a file that exists on the computer.
-
- :::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/Overview/example3.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example3.vb" id="Snippet3":::
-
- ]]>
-
+
+ constructors.
+
+ :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp" id="Snippet1":::
+ :::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/Overview/fstream class.cs" id="Snippet1":::
+ :::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/Overview/fstream class.fs" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FStream Class/VB/fstream class.vb" id="Snippet1":::
+
+ The following example shows how to write to a file asynchronously. This code runs in a WPF app that has a TextBlock named UserInput and a button hooked up to a Click event handler that is named Button_Click. The file path needs to be changed to a file that exists on the computer.
+
+ :::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/Overview/example3.cs" id="Snippet3":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example3.vb" id="Snippet3":::
+ ]]>
+
+ For more information about this API, see Supplemental API remarks for FileStream.
@@ -182,29 +150,29 @@
A bitwise combination of the enumeration values that sets the and properties of the object.
Initializes a new instance of the class for the specified file handle, with the specified read/write permission.
- is called, the handle is also closed and the file's handle count is decremented.
-
- `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle.
-
+ is called, the handle is also closed and the file's handle count is decremented.
+
+ `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle.
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
is not a field of .
The caller does not have the required permission.
- An I/O error, such as a disk error, occurred.
-
- -or-
-
+ An I/O error, such as a disk error, occurred.
+
+ -or-
+
The stream has been closed.
The requested is not permitted by the operating system for the specified file handle, such as when is or and the file handle is set for read-only access.
File and Stream I/O
@@ -280,29 +248,29 @@
A bitwise combination of the enumeration values that sets the and properties of the object.
Initializes a new instance of the class for the specified file handle, with the specified read/write permission.
- is called, the handle is also closed and the file's handle count is decremented.
-
- `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle.
-
+ is called, the handle is also closed and the file's handle count is decremented.
+
+ `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle.
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
is not a field of .
The caller does not have the required permission.
- An I/O error, such as a disk error, occurred.
-
- -or-
-
+ An I/O error, such as a disk error, occurred.
+
+ -or-
+
The stream has been closed.
The requested is not permitted by the operating system for the specified file handle, such as when is or and the file handle is set for read-only access.
File and Stream I/O
@@ -360,49 +328,49 @@
One of the enumeration values that determines how to open or create the file.
Initializes a new instance of the class with the specified path and creation mode.
- [!NOTE]
-> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
-
- is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
- For constructors without a parameter, if the `mode` parameter is set to , is the default access. Otherwise, the access is set to .
-
+> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
+
+ is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
+ For constructors without a parameter, if the `mode` parameter is set to , is the default access. Otherwise, the access is set to .
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
-
-
-## Examples
- The following code example shows how to write data to a file, byte by byte, and then verify that the data was written correctly.
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
+
+
+## Examples
+ The following code example shows how to write data to a file, byte by byte, and then verify that the data was written correctly.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream1/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream1/VB/source.vb" id="Snippet1":::
+
]]>
- .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
-
- -or-
-
+ .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
+
+ -or-
+
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
@@ -412,10 +380,10 @@
The file cannot be found, such as when is or , and the file specified by does not exist. The file must already exist in these modes.
specifies a file that is read-only.
- An I/O error, such as specifying when the file specified by already exists, occurred.
-
- -or-
-
+ An I/O error, such as specifying when the file specified by already exists, occurred.
+
+ -or-
+
The stream has been closed.
The specified path is invalid, such as being on an unmapped drive.
The specified path, file name, or both exceed the system-defined maximum length.
@@ -552,30 +520,30 @@ The file was too large (when A positive value greater than 0 indicating the buffer size. The default buffer size is 4096.
Initializes a new instance of the class for the specified file handle, with the specified read/write permission, and buffer size.
- before using the handle, and avoid calling any methods other than `Close` after you are done using the handle. Alternately, read and write to the handle before calling this `FileStream` constructor.
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
+ before using the handle, and avoid calling any methods other than `Close` after you are done using the handle. Alternately, read and write to the handle before calling this `FileStream` constructor.
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
- The parameter is an invalid handle.
-
- -or-
-
+ The parameter is an invalid handle.
+
+ -or-
+
The parameter is a synchronous handle and it was used asynchronously.
The parameter is negative.
- An I/O error, such as a disk error, occurred.
-
- -or-
-
+ An I/O error, such as a disk error, occurred.
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The requested is not permitted by the operating system for the specified file handle, such as when is or and the file handle is set for read-only access.
@@ -655,29 +623,29 @@ The file was too large (when if the file handle will be owned by this instance; otherwise, .
Initializes a new instance of the class for the specified file handle, with the specified read/write permission and instance ownership.
- method will also close the handle and the file's handle count is decremented. The `FileStream` object is given the default buffer size of 4096 bytes.
-
- `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling methods other than `Close` after you are done using the handle.
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
+ method will also close the handle and the file's handle count is decremented. The `FileStream` object is given the default buffer size of 4096 bytes.
+
+ `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling methods other than `Close` after you are done using the handle.
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
is not a field of .
The caller does not have the required permission.
- An I/O error, such as a disk error, occurred.
-
- -or-
-
+ An I/O error, such as a disk error, occurred.
+
+ -or-
+
The stream has been closed.
The requested is not permitted by the operating system for the specified file handle, such as when is or and the file handle is set for read-only access.
File and Stream I/O
@@ -737,43 +705,43 @@ The file was too large (when A bitwise combination of the enumeration values that determines how the file can be accessed by the object. This also determines the values returned by the and properties of the object. is if specifies a disk file.
Initializes a new instance of the class with the specified path, creation mode, and read/write permission.
- [!NOTE]
-> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
-
- is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
+> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
+
+ is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
is .
- .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
-
- -or-
-
+ .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
+
+ -or-
+
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
The file cannot be found, such as when is or , and the file specified by does not exist. The file must already exist in these modes.
- An I/O error, such as specifying when the file specified by already exists, occurred.
-
- -or-
-
+ An I/O error, such as specifying when the file specified by already exists, occurred.
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The specified path is invalid, such as being on an unmapped drive.
@@ -840,32 +808,32 @@ The file was too large (when if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, .
Initializes a new instance of the class for the specified file handle, with the specified read/write permission, buffer size, and synchronous or asynchronous state.
- , , or method. When the `isAsync` parameter is `false` and you call the asynchronous read and write operations, the UI thread is still not blocked, but the actual I/O operation is performed synchronously.
-
- `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle. Alternately, read and write to the handle before calling this `FileStream` constructor.
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
+ , , or method. When the `isAsync` parameter is `false` and you call the asynchronous read and write operations, the UI thread is still not blocked, but the actual I/O operation is performed synchronously.
+
+ `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle. Alternately, read and write to the handle before calling this `FileStream` constructor.
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
- The parameter is an invalid handle.
-
- -or-
-
+ The parameter is an invalid handle.
+
+ -or-
+
The parameter is a synchronous handle and it was used asynchronously.
The parameter is negative.
- An I/O error, such as a disk error, occurred.
-
- -or-
-
+ An I/O error, such as a disk error, occurred.
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The requested is not permitted by the operating system for the specified file handle, such as when is or and the file handle is set for read-only access.
@@ -947,28 +915,28 @@ The file was too large (when A positive value greater than 0 indicating the buffer size. The default buffer size is 4096.
Initializes a new instance of the class for the specified file handle, with the specified read/write permission, instance ownership, and buffer size.
- method will also close the handle. In particular, the file's handle count is decremented. The `FileStream` object is given the specified buffer size.
-
- `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle. Alternately, read and write to the handle before calling this `FileStream` constructor.
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
+ method will also close the handle. In particular, the file's handle count is decremented. The `FileStream` object is given the specified buffer size.
+
+ `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle. Alternately, read and write to the handle before calling this `FileStream` constructor.
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
is negative.
- An I/O error, such as a disk error, occurred.
-
- -or-
-
+ An I/O error, such as a disk error, occurred.
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The requested is not permitted by the operating system for the specified file handle, such as when is or and the file handle is set for read-only access.
@@ -1031,51 +999,51 @@ The file was too large (when A bitwise combination of the enumeration values that determines how the file will be shared by processes.
Initializes a new instance of the class with the specified path, creation mode, read/write permission, and sharing permission.
- [!NOTE]
-> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
-
- is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
-
+> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
+
+ is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
-
-
-## Examples
- This code example is part of a larger example provided for the method.
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
+
+
+## Examples
+ This code example is part of a larger example provided for the method.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/fstreamlock.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/fstreamlock.fs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream3/VB/fstreamlock.vb" id="Snippet2":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream3/VB/fstreamlock.vb" id="Snippet2":::
+
]]>
is .
- .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
-
- -or-
-
+ .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
+
+ -or-
+
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
The file cannot be found, such as when is or , and the file specified by does not exist. The file must already exist in these modes.
An I/O error, such as specifying when the file specified by already exists, occurred.
-
- -or-
-
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The specified path is invalid, such as being on an unmapped drive.
@@ -1164,29 +1132,29 @@ The file was too large (when if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, .
Initializes a new instance of the class for the specified file handle, with the specified read/write permission, instance ownership, buffer size, and synchronous or asynchronous state.
- method will also close the handle. In particular, the file's handle count is decremented. The `FileStream` object is given the specified buffer size.
-
- `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle. Alternately, read and write to the handle before calling this `FileStream` constructor.
-
- `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
-
+ method will also close the handle. In particular, the file's handle count is decremented. The `FileStream` object is given the specified buffer size.
+
+ `FileStream` assumes that it has exclusive control over the handle. Reading, writing, or seeking while a `FileStream` is also holding a handle could result in data corruption. For data safety, call before using the handle, and avoid calling any methods other than `Close` after you are done using the handle. Alternately, read and write to the handle before calling this `FileStream` constructor.
+
+ `FileShare.Read` is the default for those constructors without a `FileShare` parameter.
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
is less than or greater than or is less than or equal to 0.
The handle is invalid.
- An I/O error, such as a disk error, occurred.
-
- -or-
-
+ An I/O error, such as a disk error, occurred.
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The requested is not permitted by the operating system for the specified file handle, such as when is or and the file handle is set for read-only access.
@@ -1251,45 +1219,45 @@ The file was too large (when A positive value greater than 0 indicating the buffer size. The default buffer size is 4096.
Initializes a new instance of the class with the specified path, creation mode, read/write and sharing permission, and buffer size.
- [!NOTE]
-> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
-
- is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
-
+> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
+
+ is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
is .
- .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
-
- -or-
-
+ .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
+
+ -or-
+
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
- is negative or zero.
-
- -or-
-
+ is negative or zero.
+
+ -or-
+
, , or contain an invalid value.
The file cannot be found, such as when is or , and the file specified by does not exist. The file must already exist in these modes.
An I/O error, such as specifying when the file specified by already exists, occurred.
-
- -or-
-
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The specified path is invalid, such as being on an unmapped drive.
@@ -1358,55 +1326,55 @@ The file was too large (when Specifies whether to use asynchronous I/O or synchronous I/O. However, note that the underlying operating system might not support asynchronous I/O, so when specifying , the handle might be opened synchronously depending on the platform. When opened asynchronously, the and methods perform better on large reads or writes, but they might be much slower for small reads or writes. If the application is designed to take advantage of asynchronous I/O, set the parameter to . Using asynchronous I/O correctly can speed up applications by as much as a factor of 10, but using it without redesigning the application for asynchronous I/O can decrease performance by as much as a factor of 10.
Initializes a new instance of the class with the specified path, creation mode, read/write and sharing permission, buffer size, and synchronous or asynchronous state.
- [!NOTE]
-> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
-
- is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
-
+> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
+
+ is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
-
-
-## Examples
- The following code example shows how to asynchronously write data to a file and then verify that the data was written correctly. A `State` object is created to pass information from the main thread to the `EndReadCallback` and `EndWriteCallback` methods.
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
+
+
+## Examples
+ The following code example shows how to asynchronously write data to a file and then verify that the data was written correctly. A `State` object is created to pass information from the main thread to the `EndReadCallback` and `EndWriteCallback` methods.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source1.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source1.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet1":::
+
]]>
is .
- .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
-
- -or-
-
+ .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
+
+ -or-
+
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
- is negative or zero.
-
- -or-
-
+ is negative or zero.
+
+ -or-
+
, , or contain an invalid value.
The file cannot be found, such as when is or , and the file specified by does not exist. The file must already exist in these modes.
An I/O error, such as specifying when the file specified by already exists, occurred.
-
- -or-
-
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The specified path is invalid, such as being on an unmapped drive.
@@ -1475,64 +1443,64 @@ The file was too large (when A bitwise combination of the enumeration values that specifies additional file options.
Initializes a new instance of the class with the specified path, creation mode, read/write and sharing permission, the access other FileStreams can have to the same file, the buffer size, and additional file options.
- object.
-
- The `path` parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.
-
+ object.
+
+ The `path` parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.
+
> [!NOTE]
-> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
-
- is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
-
+> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
+
+ is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
-
-
-## Examples
- The following example writes data to a file and then reads the data using the object.
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
+
+
+## Examples
+ The following example writes data to a file and then reads the data using the object.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/example.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/example.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IO.FileStream.ctor1/VB/example.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IO.FileStream.ctor1/VB/example.vb" id="Snippet1":::
+
]]>
is .
- .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
-
- -or-
-
+ .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
+
+ -or-
+
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
- is negative or zero.
-
- -or-
-
+ is negative or zero.
+
+ -or-
+
, , or contain an invalid value.
The file cannot be found, such as when is or , and the file specified by does not exist. The file must already exist in these modes.
- An I/O error, such as specifying when the file specified by already exists, occurred.
-
- -or-
-
+ An I/O error, such as specifying when the file specified by already exists, occurred.
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The specified path is invalid, such as being on an unmapped drive.
- The requested is not permitted by the operating system for the specified , such as when is or and the file or directory is set for read-only access.
-
- -or-
-
+ The requested is not permitted by the operating system for the specified , such as when is or and the file or directory is set for read-only access.
+
+ -or-
+
is specified for , but file encryption is not supported on the current platform.
The specified path, file name, or both exceed the system-defined maximum length.
File and Stream I/O
@@ -1586,57 +1554,57 @@ The file was too large (when A bitwise combination of the enumeration values that specifies additional file options.
Initializes a new instance of the class with the specified path, creation mode, access rights and sharing permission, the buffer size, and additional file options.
- constructor to apply access rights at the point of creation of a file. To access or modify rights on an existing file, consider using the and methods.
-
- The `fileOptions` parameter is used to provide access to more advanced operations that can be leveraged when creating a object.
-
- The `path` parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.
-
+ constructor to apply access rights at the point of creation of a file. To access or modify rights on an existing file, consider using the and methods.
+
+ The `fileOptions` parameter is used to provide access to more advanced operations that can be leveraged when creating a object.
+
+ The `path` parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.
+
> [!NOTE]
-> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
-
- is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
-
+> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
+
+ is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
is .
- .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
-
- -or-
-
+ .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
+
+ -or-
+
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
- is negative or zero.
-
- -or-
-
+ is negative or zero.
+
+ -or-
+
, , or contain an invalid value.
The file cannot be found, such as when is or , and the file specified by does not exist. The file must already exist in these modes.
The current operating system is not Windows NT or later.
- An I/O error, such as specifying when the file specified by already exists, occurred.
-
- -or-
-
+ An I/O error, such as specifying when the file specified by already exists, occurred.
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The specified path is invalid, such as being on an unmapped drive.
- The requested is not permitted by the operating system for the specified , such as when is or and the file or directory is set for read-only access.
-
- -or-
-
+ The requested is not permitted by the operating system for the specified , such as when is or and the file or directory is set for read-only access.
+
+ -or-
+
is specified for , but file encryption is not supported on the current platform.
The specified , file name, or both exceed the system-defined maximum length.
File and Stream I/O
@@ -1692,67 +1660,67 @@ The file was too large (when An object that determines the access control and audit security for the file.
Initializes a new instance of the class with the specified path, creation mode, access rights and sharing permission, the buffer size, additional file options, access control and audit security.
- constructor to apply access rights at the point of creation of a file. To access or modify rights on an existing file, consider using the and methods.
-
- The `fileOptions` parameter is used to provide access to more advanced operations that can be leveraged when creating a object.
-
- The `path` parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.
-
+ constructor to apply access rights at the point of creation of a file. To access or modify rights on an existing file, consider using the and methods.
+
+ The `fileOptions` parameter is used to provide access to more advanced operations that can be leveraged when creating a object.
+
+ The `path` parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.
+
> [!NOTE]
-> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
-
- is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
-
+> `path` is not required to be a file stored on disk; it can be any part of a system that supports access through streams. For example, depending on the system, this class can access a physical device.
+
+ is `true` for all objects that encapsulate files. If `path` indicates a device that does not support seeking, the property on the resulting is `false`. For additional information, see .
+
> [!CAUTION]
-> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> When you compile a set of characters with a particular cultural setting and retrieve those same characters with a different cultural setting, the characters might not be interpretable, and could cause an exception to be thrown.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
> [!IMPORTANT]
> This constructor does not exist in .NET Core. Instead, starting in .NET Core 3.1, you can use the following extension method of the `FileSystemAclExtensions` class inside the `System.Security.AccessControl` assembly: .
-
-## Examples
- The following example writes data to a file and then reads the data using the object.
-
+
+## Examples
+ The following example writes data to a file and then reads the data using the object.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileOptions/Overview/example.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileOptions/Overview/example.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IO.FileStream.ctor2/VB/example.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/IO.FileStream.ctor2/VB/example.vb" id="Snippet1":::
+
]]>
is .
- .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
-
- -or-
-
+ .NET Framework and .NET Core versions older than 2.1: is an empty string (""), contains only white space, or contains one or more invalid characters.
+
+ -or-
+
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.
refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.
- is negative or zero.
-
- -or-
-
+ is negative or zero.
+
+ -or-
+
, , or contain an invalid value.
The file cannot be found, such as when is or , and the file specified by does not exist. The file must already exist in these modes.
- An I/O error, such as specifying when the file specified by already exists, occurred.
-
- -or-
-
+ An I/O error, such as specifying when the file specified by already exists, occurred.
+
+ -or-
+
The stream has been closed.
The caller does not have the required permission.
The specified path is invalid, such as being on an unmapped drive.
- The requested is not permitted by the operating system for the specified , such as when is or and the file or directory is set for read-only access.
-
- -or-
-
+ The requested is not permitted by the operating system for the specified , such as when is or and the file or directory is set for read-only access.
+
+ -or-
+
is specified for , but file encryption is not supported on the current platform.
The specified , file name, or both exceed the system-defined maximum length.
The current operating system is not Windows NT or later.
@@ -2009,23 +1977,23 @@ The file was too large (when if the stream supports reading; if the stream is closed or was opened with write-only access.
- does not support reading, calls to the , , and methods throw a .
-
- If the stream is closed, this property returns `false`.
-
-
-
-## Examples
- The following example demonstrates a use of the `CanRead` property. The output of this code is "MyFile.txt is not writable." To get the output message "MyFile.txt can be both written to and read from.", change the `FileAccess` parameter to `ReadWrite` in the `FileStream` constructor.
-
+ does not support reading, calls to the , , and methods throw a .
+
+ If the stream is closed, this property returns `false`.
+
+
+
+## Examples
+ The following example demonstrates a use of the `CanRead` property. The output of this code is "MyFile.txt is not writable." To get the output message "MyFile.txt can be both written to and read from.", change the `FileAccess` parameter to `ReadWrite` in the `FileStream` constructor.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/CanRead/source.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/CanRead/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/VB/source.vb" id="Snippet1":::
+
]]>
File and Stream I/O
@@ -2076,23 +2044,23 @@ The file was too large (when if the stream supports seeking; if the stream is closed or if the was constructed from an operating-system handle such as a pipe or output to the console.
- does not support seeking, calls to , , , and throw a .
-
- If the stream is closed, this property returns `false`.
-
-
-
-## Examples
- The following example uses the `CanSeek` property to check whether a stream supports seeking.
-
+ does not support seeking, calls to , , , and throw a .
+
+ If the stream is closed, this property returns `false`.
+
+
+
+## Examples
+ The following example uses the `CanSeek` property to check whether a stream supports seeking.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/CanSeek/fstream canseek.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/CanSeek/fstream canseek.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FStream CanSeek/VB/fstream canseek.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FStream CanSeek/VB/fstream canseek.vb" id="Snippet1":::
+
]]>
File and Stream I/O
@@ -2143,30 +2111,30 @@ The file was too large (when if the stream supports writing; if the stream is closed or was opened with read-only access.
- does not support writing, a call to , , , or throws a .
-
- If the stream is closed, this property returns `false`.
-
-
-
-## Examples
- The following example uses the `CanWrite` property to check whether a stream supports writing.
-
+ does not support writing, a call to , , , or throws a .
+
+ If the stream is closed, this property returns `false`.
+
+
+
+## Examples
+ The following example uses the `CanWrite` property to check whether a stream supports writing.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/CanWrite/fstream canwrite.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/CanWrite/fstream canwrite.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FStream CanWrite/VB/fstream canwrite.vb" id="Snippet1":::
-
- The following is an example using the `CanWrite` property. The output of this code is "MyFile.txt is writable." To get the output message "MyFile.txt can be both written to and read from.", change the `FileAccess` parameter to `ReadWrite` in the `FileStream` constructor.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FStream CanWrite/VB/fstream canwrite.vb" id="Snippet1":::
+
+ The following is an example using the `CanWrite` property. The output of this code is "MyFile.txt is writable." To get the output message "MyFile.txt can be both written to and read from.", change the `FileAccess` parameter to `ReadWrite` in the `FileStream` constructor.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/CanWrite/source.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/CanWrite/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/VB/source.vb" id="Snippet1":::
+
]]>
File and Stream I/O
@@ -2328,19 +2296,19 @@ For an example of copying between two streams, see the to release both managed and unmanaged resources; to release only unmanaged resources.
Releases the unmanaged resources used by the and optionally releases the managed resources.
- method and the method, if it has been overridden. invokes the protected method with the `disposing` parameter set to `true`. `Finalize` invokes with `disposing` set to `false`.
-
- When the `disposing` parameter is `true`, this method releases all resources held by any managed objects that this references. This method invokes the `Dispose()` method of each referenced object.
-
+ method and the method, if it has been overridden. invokes the protected method with the `disposing` parameter set to `true`. `Finalize` invokes with `disposing` set to `false`.
+
+ When the `disposing` parameter is `true`, this method releases all resources held by any managed objects that this references. This method invokes the `Dispose()` method of each referenced object.
+
]]>
- can be called multiple times by other objects. When overriding be careful not to reference objects that have been previously disposed of in an earlier call to . For more information about how to implement , see [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).
-
+ can be called multiple times by other objects. When overriding be careful not to reference objects that have been previously disposed of in an earlier call to . For more information about how to implement , see [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).
+
For more information about and , see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged).
File and Stream I/O
@@ -2383,7 +2351,7 @@ For an example of copying between two streams, see the Asynchronously releases the unmanaged resources used by the .
A task that represents the asynchronous dispose operation.
- Waits for the pending asynchronous read operation to complete. (Consider using instead.)
The number of bytes read from the stream, between 0 and the number of bytes you requested. Streams only return 0 at the end of the stream, otherwise, they should block until at least 1 byte is available.
- and to implement asynchronous file operations. These methods are still available in the .NET Framework 4.5 to support legacy code; however, the new async methods, such as , , , and , help you implement asynchronous file operations more easily.
-
- must be called exactly for every call to . Failing to end a read process before beginning another read can cause undesirable behavior such as deadlock.
-
- This method overrides .
-
- can be called on every from . Calling tells you how many bytes were read from the stream. will block until the I/O operation has completed.
-
-
-
-## Examples
- This code example is part of a larger example provided for the constructor.
-
+ and to implement asynchronous file operations. These methods are still available in the .NET Framework 4.5 to support legacy code; however, the new async methods, such as , , , and , help you implement asynchronous file operations more easily.
+
+ must be called exactly for every call to . Failing to end a read process before beginning another read can cause undesirable behavior such as deadlock.
+
+ This method overrides .
+
+ can be called on every from . Calling tells you how many bytes were read from the stream. will block until the I/O operation has completed.
+
+
+
+## Examples
+ This code example is part of a larger example provided for the constructor.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source1.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source1.fs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet4":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet4":::
+
]]>
@@ -2531,25 +2499,25 @@ Calling `DisposeAsync` allows the resources used by the The pending asynchronous I/O request.
Ends an asynchronous write operation and blocks until the I/O operation is complete. (Consider using instead.)
- and to implement asynchronous file operations. These methods are still available in the .NET Framework 4.5 to support legacy code; however, the new async methods, such as , , , and , help you implement asynchronous file operations more easily.
-
- This method overrides .
-
- must be called exactly once on every from . will block until the I/O operation has completed.
-
-
-
-## Examples
- This code example is part of a larger example provided for the constructor.
-
+ and to implement asynchronous file operations. These methods are still available in the .NET Framework 4.5 to support legacy code; however, the new async methods, such as , , , and , help you implement asynchronous file operations more easily.
+
+ This method overrides .
+
+ must be called exactly once on every from . will block until the I/O operation has completed.
+
+
+
+## Examples
+ This code example is part of a larger example provided for the constructor.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source1.cs" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source1.fs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet3":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet3":::
+
]]>
@@ -2612,11 +2580,11 @@ Calling `DisposeAsync` allows the resources used by the
Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the .
-
File and Stream I/O
@@ -2681,33 +2649,33 @@ Calling `DisposeAsync` allows the resources used by the
Clears buffers for this stream and causes any buffered data to be written to the file.
- .
-
- When you call the method, the operating system I/O buffer is also flushed.
-
- A stream's encoder is not flushed unless you explicitly call or dispose of the object. Setting to `true` means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.
-
- Because a buffer can be used for either reading or writing, performs the following two functions:
-
-- Any data previously written to the buffer is copied to the file and the buffer is cleared except for its encoder state.
-
-- If is `true` and data was previously copied from the file to the buffer for reading, the current position within the file is decremented by the number of unread bytes in the buffer. The buffer is then cleared.
-
- Use the method overload when you want to ensure that all buffered data in intermediate file buffers is written to disk.
-
-
-
-## Examples
- This code example is part of a larger example provided for the method.
-
+ .
+
+ When you call the method, the operating system I/O buffer is also flushed.
+
+ A stream's encoder is not flushed unless you explicitly call or dispose of the object. Setting to `true` means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.
+
+ Because a buffer can be used for either reading or writing, performs the following two functions:
+
+- Any data previously written to the buffer is copied to the file and the buffer is cleared except for its encoder state.
+
+- If is `true` and data was previously copied from the file to the buffer for reading, the current position within the file is decremented by the number of unread bytes in the buffer. The buffer is then cleared.
+
+ Use the method overload when you want to ensure that all buffered data in intermediate file buffers is written to disk.
+
+
+
+## Examples
+ This code example is part of a larger example provided for the method.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/fstreamlock.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/fstreamlock.fs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream3/VB/fstreamlock.vb" id="Snippet4":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream3/VB/fstreamlock.vb" id="Snippet4":::
+
]]>
An I/O error occurred.
@@ -2766,13 +2734,13 @@ Calling `DisposeAsync` allows the resources used by the to flush all intermediate file buffers; otherwise, .
Clears buffers for this stream and causes any buffered data to be written to the file, and also clears all intermediate file buffers.
- method, the operating system I/O buffer is also flushed.
-
+ method, the operating system I/O buffer is also flushed.
+
]]>
@@ -2832,11 +2800,11 @@ Calling `DisposeAsync` allows the resources used by the Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.
A task that represents the asynchronous flush operation.
- value for the property. If the handle to the file is disposed, the returned task contains the exception in the property.
-
+ value for the property. If the handle to the file is disposed, the returned task contains the exception in the property.
+
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
]]>
@@ -2883,24 +2851,24 @@ Calling `DisposeAsync` allows the resources used by the Gets a object that encapsulates the access control list (ACL) entries for the file described by the current object.
An object that encapsulates the access control settings for the file described by the current object.
- class and can be used to retrieve the access control list (ACL) entries of an existing file, consider using method, as it is easier to use.
-
- Use the method to retrieve the ACL entries for a file.
-
- An ACL describes individuals and/or groups who have, or do not have, rights to specific actions on the given file. For more information, see [How to: Add or Remove Access Control List Entries](/dotnet/standard/io/how-to-add-or-remove-access-control-list-entries).
-
+ class and can be used to retrieve the access control list (ACL) entries of an existing file, consider using method, as it is easier to use.
+
+ Use the method to retrieve the ACL entries for a file.
+
+ An ACL describes individuals and/or groups who have, or do not have, rights to specific actions on the given file. For more information, see [How to: Add or Remove Access Control List Entries](/dotnet/standard/io/how-to-add-or-remove-access-control-list-entries).
+
]]>
The file is closed.
An I/O error occurred while opening the file.
The file could not be found.
- This operation is not supported on the current platform.
-
- -or-
-
+ This operation is not supported on the current platform.
+
+ -or-
+
The caller does not have the required permission.
@@ -2966,16 +2934,16 @@ Calling `DisposeAsync` allows the resources used by the Gets the operating system file handle for the file that the current object encapsulates.
The operating system file handle for the file encapsulated by this object, or -1 if the has been closed.
- property to discover whether this handle was opened asynchronously. In Win32, this means the handle was opened for overlapped IO, and it requires different parameters to `ReadFile` and `WriteFile`.
-
+ property to discover whether this handle was opened asynchronously. In Win32, this means the handle was opened for overlapped IO, and it requires different parameters to `ReadFile` and `WriteFile`.
+
> [!CAUTION]
-> Data corruption might occur if a `FileStream` is created, its handle is passed, some operation moves the handle's file pointer, and then the `FileStream` is used again. Multiple threads cannot safely write to the same file simultaneously, and `FileStream` buffering code assumes that it exclusively controls the handle. `FileStream` might throw an if `FileStream` detects that some other process has moved the file pointer. To avoid this, do not write any data into a portion of the file that `FileStream` might have buffered, and restore the file pointer to the location it had when methods were last called on `FileStream`.
-
+> Data corruption might occur if a `FileStream` is created, its handle is passed, some operation moves the handle's file pointer, and then the `FileStream` is used again. Multiple threads cannot safely write to the same file simultaneously, and `FileStream` buffering code assumes that it exclusively controls the handle. `FileStream` might throw an if `FileStream` detects that some other process has moved the file pointer. To avoid this, do not write any data into a portion of the file that `FileStream` might have buffered, and restore the file pointer to the location it had when methods were last called on `FileStream`.
+
]]>
The caller does not have the required permission.
@@ -3027,23 +2995,23 @@ Calling `DisposeAsync` allows the resources used by the
if the was opened asynchronously; otherwise, .
- property correctly. In Win32, `IsAsync` being true means the handle was opened for overlapped I/O, and thus requires different parameters to `ReadFile` and `WriteFile`.
-
- You specify this value when you create an instance of the class using a constructor that has an `isAsync`, `useAsync`, or `options` parameter. When the property is `true`, the stream utilizes overlapped I/O to perform file operations asynchronously. However, the property does not have to be `true` to call the , , or method. When the property is `false` and you call the asynchronous read and write operations, the UI thread is still not blocked, but the actual I/O operation is performed synchronously.
-
-
-
-## Examples
- This code example is part of a larger example provided for the constructor.
-
+ property correctly. In Win32, `IsAsync` being true means the handle was opened for overlapped I/O, and thus requires different parameters to `ReadFile` and `WriteFile`.
+
+ You specify this value when you create an instance of the class using a constructor that has an `isAsync`, `useAsync`, or `options` parameter. When the property is `true`, the stream utilizes overlapped I/O to perform file operations asynchronously. However, the property does not have to be `true` to call the , , or method. When the property is `false` and you call the asynchronous read and write operations, the UI thread is still not blocked, but the actual I/O operation is performed synchronously.
+
+
+
+## Examples
+ This code example is part of a larger example provided for the constructor.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source1.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source1.fs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet2":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet2":::
+
]]>
File and Stream I/O
@@ -3099,21 +3067,21 @@ Calling `DisposeAsync` allows the resources used by the Gets the length in bytes of the stream.
A long value representing the length of the stream in bytes.
-
@@ -3191,23 +3159,23 @@ Calling `DisposeAsync` allows the resources used by the The range to be locked.
Prevents other processes from reading from or writing to the .
-
@@ -3270,24 +3238,24 @@ Calling `DisposeAsync` allows the resources used by the Gets the absolute path of the file opened in the .
A string that is the absolute path of the file.
- constructor.
-
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
+
+
+## Examples
+ This code example is part of a larger example provided for the constructor.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source1.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source1.fs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet4":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream2/VB/source.vb" id="Snippet4":::
+
]]>
File and Stream I/O
@@ -3347,21 +3315,21 @@ If the absolute path is not known, this property returns a string similar to "[U
Gets or sets the current position of this stream.
The current position of this stream.
-
The stream does not support seeking.
@@ -3495,30 +3463,30 @@ Use for reading primitive data types.
Reads a block of bytes from the stream and writes the data in a given buffer.
The total number of bytes read into the buffer. This might be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached.
- .
-
- The `offset` parameter gives the offset of the byte in `array` (the buffer index) at which to begin reading, and the `count` parameter gives the maximum number of bytes to be read from this stream. The returned value is the actual number of bytes read, or zero if the end of the stream is reached. If the read operation is successful, the current position of the stream is advanced by the number of bytes read. If an exception occurs, the current position of the stream is unchanged.
-
- The method returns zero only after reaching the end of the stream. Otherwise, always reads at least one byte from the stream before returning. If no data is available from the stream upon a call to , the method will block until at least one byte of data can be returned. An implementation is free to return fewer bytes than requested even if the end of the stream has not been reached.
-
- Use for reading primitive data types.
-
- Do not interrupt a thread that is performing a read operation. Although the application may appear to run successfully after the thread is unblocked, the interruption can decrease your application's performance and reliability.
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
-
-
-## Examples
- The following example reads the contents from a and writes it into another .
-
+ .
+
+ The `offset` parameter gives the offset of the byte in `array` (the buffer index) at which to begin reading, and the `count` parameter gives the maximum number of bytes to be read from this stream. The returned value is the actual number of bytes read, or zero if the end of the stream is reached. If the read operation is successful, the current position of the stream is advanced by the number of bytes read. If an exception occurs, the current position of the stream is unchanged.
+
+ The method returns zero only after reaching the end of the stream. Otherwise, always reads at least one byte from the stream before returning. If no data is available from the stream upon a call to , the method will block until at least one byte of data can be returned. An implementation is free to return fewer bytes than requested even if the end of the stream has not been reached.
+
+ Use for reading primitive data types.
+
+ Do not interrupt a thread that is performing a read operation. Although the application may appear to run successfully after the thread is unblocked, the interruption can decrease your application's performance and reliability.
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
+
+
+## Examples
+ The following example reads the contents from a and writes it into another .
+
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/Read/fsread.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/Read/fsread.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FSRead/VB/fsread.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FSRead/VB/fsread.vb" id="Snippet1":::
+
]]>
@@ -3592,11 +3560,11 @@ If the operation is canceled before it completes, the returned task contains the
## Examples
-The following example shows how to read from a file asynchronously.
+The following example shows how to read from a file asynchronously.
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/Overview/example4.cs" id="Snippet4":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/Overview/example4.fs" id="Snippet4":::
-:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example4.vb" id="Snippet4":::
+:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example4.vb" id="Snippet4":::
]]>
@@ -3746,31 +3714,31 @@ The following example shows how to read from a file asynchronously.
Reads a byte from the file and advances the read position one byte.
The byte, cast to an , or -1 if the end of the stream has been reached.
- .
-
+ .
+
> [!NOTE]
-> Use the property to determine whether the current instance supports reading. For additional information, see .
-
-
-
-## Examples
- The following code example shows how to write data to a file, byte by byte, and then verify that the data was written correctly.
-
+> Use the property to determine whether the current instance supports reading. For additional information, see .
+
+
+
+## Examples
+ The following code example shows how to write data to a file, byte by byte, and then verify that the data was written correctly.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream1/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream1/VB/source.vb" id="Snippet1":::
+
]]>
The current stream does not support reading.
The current stream is closed.
- The default implementation on creates a new single-byte array and then calls . While this is formally correct, it is inefficient. Any stream with an internal buffer should override this method and provide a much more efficient version that reads the buffer directly, avoiding the extra array allocation on every call.
-
+ The default implementation on creates a new single-byte array and then calls . While this is formally correct, it is inefficient. Any stream with an internal buffer should override this method and provide a much more efficient version that reads the buffer directly, avoiding the extra array allocation on every call.
+
For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
File and Stream I/O
@@ -3825,11 +3793,11 @@ The following example shows how to read from a file asynchronously.
Gets a object that represents the operating system file handle for the file that the current object encapsulates.
An object that represents the operating system file handle for the file that the current object encapsulates.
- property automatically flushes the stream and sets the current stream position to 0. This allows the file to be moved or the stream position to be reset by another stream using the returned by this property.
-
+ property automatically flushes the stream and sets the current stream position to 0. This allows the file to be moved or the stream position to be reset by another stream using the returned by this property.
+
]]>
File and Stream I/O
@@ -3891,32 +3859,32 @@ The following example shows how to read from a file asynchronously.
Sets the current position of this stream to the given value.
The new position in the stream.
- .
-
+ .
+
> [!NOTE]
-> Use the property to determine whether the current instance supports seeking. For additional information, see .
-
+> Use the property to determine whether the current instance supports seeking. For additional information, see .
+
You can seek to any location beyond the length of the stream. When you seek beyond the length of the file, the file size grows. Data added to the end of the file is set to zero.
-
+
For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
-## Examples
- The following example shows how to write data to a file, byte by byte, and then verify that the data was written correctly.
-
+
+## Examples
+ The following example shows how to write data to a file, byte by byte, and then verify that the data was written correctly.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream1/VB/source.vb" id="Snippet1":::
-
- The following example reads text in the reverse direction, from the end of file to the beginning of the file, by using the various values with the method.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream1/VB/source.vb" id="Snippet1":::
+
+ The following example reads text in the reverse direction, from the end of file to the beginning of the file, by using the various values with the method.
+
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/Seek/source.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/Seek/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.io.filestream.seek/vb/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.io.filestream.seek/vb/source.vb" id="Snippet1":::
+
]]>
An I/O error occurred.
@@ -3967,18 +3935,18 @@ The following example shows how to read from a file asynchronously.
An object that describes an ACL entry to apply to the current file.
Applies access control list (ACL) entries described by a object to the file described by the current object.
- class and can be used on an existing file, consider using the method as it is easier to use.
-
- The method applies access control list (ACL) entries to a file that represents the noninherited ACL list.
-
+ class and can be used on an existing file, consider using the method as it is easier to use.
+
+ The method applies access control list (ACL) entries to a file that represents the noninherited ACL list.
+
> [!CAUTION]
-> The ACL specified for the `fileSecurity` parameter replaces the existing ACL for the file. To add permissions for a new user, use the method to obtain the existing ACL, modify it, and then use to apply it back to the file.
-
- An ACL describes individuals and/or groups who have, or do not have, rights to specific actions on the given file. For more information, see [How to: Add or Remove Access Control List Entries](/dotnet/standard/io/how-to-add-or-remove-access-control-list-entries).
-
+> The ACL specified for the `fileSecurity` parameter replaces the existing ACL for the file. To add permissions for a new user, use the method to obtain the existing ACL, modify it, and then use to apply it back to the file.
+
+ An ACL describes individuals and/or groups who have, or do not have, rights to specific actions on the given file. For more information, see [How to: Add or Remove Access Control List Entries](/dotnet/standard/io/how-to-add-or-remove-access-control-list-entries).
+
]]>
The file is closed.
@@ -4038,20 +4006,20 @@ The following example shows how to read from a file asynchronously.
The new length of the stream.
Sets the length of this stream to the given value.
- .
-
- If the given value is less than the current length of the stream, the stream is truncated. In this scenario, if the current position is greater than the new length, the current position is moved to the last byte of the stream. If the given value is larger than the current length of the stream, the stream is expanded, and the current position remains the same. If the stream is expanded, the contents of the stream between the old and the new length are undefined on Windows, while on Linux, that space is filled with zeros.
-
- A stream must support both writing and seeking for `SetLength` to work.
-
+ .
+
+ If the given value is less than the current length of the stream, the stream is truncated. In this scenario, if the current position is greater than the new length, the current position is moved to the last byte of the stream. If the given value is larger than the current length of the stream, the stream is expanded, and the current position remains the same. If the stream is expanded, the contents of the stream between the old and the new length are undefined on Windows, while on Linux, that space is filled with zeros.
+
+ A stream must support both writing and seeking for `SetLength` to work.
+
> [!NOTE]
-> Use the property to determine whether the current instance supports writing, and the property to determine whether seeking is supported. For additional information, see and .
-
- For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
+> Use the property to determine whether the current instance supports writing, and the property to determine whether seeking is supported. For additional information, see and .
+
+ For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
+
]]>
An I/O error has occurred.
@@ -4129,21 +4097,21 @@ The following example shows how to read from a file asynchronously.
The range to be unlocked.
Allows access by other processes to all or part of a file that was previously locked.
-
@@ -4271,29 +4239,29 @@ If the write operation is successful, the position within the file stream advanc
The maximum number of bytes to write.
Writes a block of bytes to the file stream.
- .
-
-The `offset` parameter gives the offset of the byte in `array` (the buffer index) at which to begin copying, and the `count` parameter gives the number of bytes that will be written to the stream. If the write operation is successful, the current position of the stream is advanced by the number of bytes written. If an exception occurs, the current position of the stream is unchanged.
-
+This method overrides .
+
+The `offset` parameter gives the offset of the byte in `array` (the buffer index) at which to begin copying, and the `count` parameter gives the number of bytes that will be written to the stream. If the write operation is successful, the current position of the stream is advanced by the number of bytes written. If an exception occurs, the current position of the stream is unchanged.
+
> [!NOTE]
-> Use the property to determine whether the current instance supports writing. For additional information, see .
-
-Do not interrupt a thread that's performing a write operation. Although the application may appear to run successfully after the thread is unblocked, the interruption can decrease your application's performance and reliability.
-
+> Use the property to determine whether the current instance supports writing. For additional information, see .
+
+Do not interrupt a thread that's performing a write operation. Although the application may appear to run successfully after the thread is unblocked, the interruption can decrease your application's performance and reliability.
+
For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
-
-## Examples
- This code example is part of a larger example provided for the method.
-
+
+## Examples
+ This code example is part of a larger example provided for the method.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/fstreamlock.cs" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/fstreamlock.fs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream3/VB/fstreamlock.vb" id="Snippet3":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream3/VB/fstreamlock.vb" id="Snippet3":::
+
]]>
@@ -4302,10 +4270,10 @@ For a list of common file and directory operations, see [Common I/O Tasks](/dotn
and describe an invalid range in .
or is negative.
- An I/O error occurred.
-
+ An I/O error occurred.
+
-or-
-
+
Another thread may have caused an unexpected change in the position of the operating system's file handle.
-or-
@@ -4438,20 +4406,20 @@ If the operation is canceled before it completes, the returned task contains the
Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.
A task that represents the asynchronous write operation.
- method enables you to perform resource-intensive file operations without blocking the main thread. This performance consideration is particularly important in apps where a time-consuming stream operation can block the UI thread and make your app appear as if it isn't working.
-
- Use the property to determine whether the current instance supports writing.
-
+
+ Use the property to determine whether the current instance supports writing.
+
If the operation is canceled before it completes, the returned task contains the value for the property. If the handle to the file is disposed, the returned task contains the exception in the property.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
-
-## Examples
- The following example shows how to write asynchronously to a file.
-
+
+## Examples
+ The following example shows how to write asynchronously to a file.
+
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/Overview/example3.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example3.vb" id="Snippet3":::
@@ -4520,32 +4488,32 @@ This method stores in the task it returns all non-usage exceptions that the meth
A byte to write to the stream.
Writes a byte to the current position in the file stream.
- .
-
- Use `WriteByte` to write a byte to a `FileStream` efficiently. If the stream is closed or not writable, an exception will be thrown.
-
+ .
+
+ Use `WriteByte` to write a byte to a `FileStream` efficiently. If the stream is closed or not writable, an exception will be thrown.
+
> [!NOTE]
> Use the property to determine whether the current instance supports writing. For additional information, see .
-
-## Examples
- The following code example shows how to write data to a file, byte by byte, and then verify that the data was written correctly.
-
+
+## Examples
+ The following code example shows how to write data to a file, byte by byte, and then verify that the data was written correctly.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileStream/.ctor/source.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.IO/FileStream/.ctor/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream1/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.FileStream1/VB/source.vb" id="Snippet1":::
+
]]>
The stream is closed.
The stream does not support writing.
.NET 8 and later versions: The underlying pipe is closed or disconnected.
- The default implementation on creates a new single-byte array and then calls . While this is formally correct, it is inefficient. Any stream with an internal buffer should override this method and provide a much more efficient version that reads the buffer directly, avoiding the extra array allocation on every call.
-
+ The default implementation on creates a new single-byte array and then calls . While this is formally correct, it is inefficient. Any stream with an internal buffer should override this method and provide a much more efficient version that reads the buffer directly, avoiding the extra array allocation on every call.
+
For a list of common file and directory operations, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
File and Stream I/O
diff --git a/xml/System.IO/FileSystemWatcher.xml b/xml/System.IO/FileSystemWatcher.xml
index 475487a0b02..c93fd28a409 100644
--- a/xml/System.IO/FileSystemWatcher.xml
+++ b/xml/System.IO/FileSystemWatcher.xml
@@ -81,68 +81,16 @@
Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.
-
- to watch for changes in a specified directory. You can watch for changes in files and subdirectories of the specified directory. You can create a component to watch files on a local computer, a network drive, or a remote computer.
-
- To watch for changes in all files, set the property to an empty string ("") or use wildcards ("*.\*"). To watch a specific file, set the property to the file name. For example, to watch for changes in the file MyDoc.txt, set the property to "MyDoc.txt". You can also watch for changes in a certain type of file. For example, to watch for changes in text files, set the property to "\*.txt".
-
- There are several types of changes you can watch for in a directory or file. For example, you can watch for changes in `Attributes`, the `LastWrite` date and time, or the `Size` of files or directories. This is done by setting the property to one of the values. For more information on the type of changes you can watch, see .
-
- You can watch for renaming, deletion, or creation of files or directories. For example, to watch for renaming of text files, set the property to "*.txt" and call the method with a specified for its parameter.
-
- The Windows operating system notifies your component of file changes in a buffer created by the . If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. Increasing the size of the buffer with the property is expensive, as it comes from non-paged memory that cannot be swapped out to disk, so keep the buffer as small yet large enough to not miss any file change events. To avoid a buffer overflow, use the and properties so you can filter out unwanted change notifications.
-
- For a list of initial property values for an instance of , see the constructor.
-
- Please note the following when using the class.
-
-- Hidden files are not ignored.
-
-- In some systems, reports changes to files using the short 8.3 file name format. For example, a change to "LongFileName.LongExtension" could be reported as "LongFil~.Lon".
-
-- This class contains a link demand and an inheritance demand at the class level that applies to all members. A is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see [Link Demands](/dotnet/framework/misc/link-demands).
-
-- The maximum size you can set for the property for monitoring a directory over the network is 64 KB.
-
-## Copying and moving folders
- The operating system and object interpret a cut-and-paste action or a move action as a rename action for a folder and its contents. If you cut and paste a folder with files into a folder being watched, the object reports only the folder as new, but not its contents because they are essentially only renamed.
-
- To be notified that the contents of folders have been moved or copied into a watched folder, provide and event handler methods as suggested in the following table.
-
-|Event Handler|Events Handled|Performs|
-|-------------------|--------------------|--------------|
-||, , |Report changes in file attributes, created files, and deleted files.|
-|||List the old and new paths of renamed files and folders, expanding recursively if needed.|
-
-## Events and Buffer Sizes
- Note that several factors can affect which file system change events are raised, as described by the following:
-
-- Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
-
-- The can watch disks as long as they are not switched or removed. The does not raise events for CDs and DVDs, because time stamps and properties cannot change. Remote computers must have one of the required platforms installed for the component to function properly.
-
- Note that a may miss an event when the buffer size is exceeded. To avoid missing events, follow these guidelines:
-
-- Increase the buffer size by setting the property.
-
-- Avoid watching files with long file names, because a long file name contributes to filling up the buffer. Consider renaming these files using shorter names.
-
-- Keep your event handling code as short as possible.
-
-
-
-## Examples
- The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
- :::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
- ]]>
-
+
+ to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
+
+ :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
+ :::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+ ]]>
+
+ For more information about this API, see Supplemental API remarks for FileSystemWatcher.
@@ -201,36 +149,36 @@
Initializes a new instance of the class.
- .
-
-|Property|Initial Value|
-|--------------|-------------------|
-||bitwise OR combination of `LastWrite`, `FileName`, and `DirectoryName`|
-||`false`|
-||"*.\*" (Watch all files.)|
-||`false`|
-||8192|
-||empty string ("")|
-
+ .
+
+|Property|Initial Value|
+|--------------|-------------------|
+||bitwise OR combination of `LastWrite`, `FileName`, and `DirectoryName`|
+||`false`|
+||"*.\*" (Watch all files.)|
+||`false`|
+||8192|
+||empty string ("")|
+
> [!NOTE]
-> The component will not watch the specified directory until the is set, and is `true`.
-
-
-
-## Examples
- The following example creates a object to watch the directory specified at run time. The object watches for changes in `LastWrite` and `LastAccess` times, and for the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file displays to the console. When a file is renamed, the old and new paths display to the console.
-
- This example uses the and namespaces.
-
+> The component will not watch the specified directory until the is set, and is `true`.
+
+
+
+## Examples
+ The following example creates a object to watch the directory specified at run time. The object watches for changes in `LastWrite` and `LastAccess` times, and for the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file displays to the console. When a file is renamed, the old and new paths display to the console.
+
+ This example uses the and namespaces.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -292,24 +240,24 @@
The directory to monitor, in standard or Universal Naming Convention (UNC) notation.
Initializes a new instance of the class, given the specified directory to monitor.
- [!NOTE]
-> The component will not watch the specified directory until the is set, and is `true`.
-
- The component can watch files on your personal computer, a network drive, or a remote computer.
-
- You cannot watch a remote computer that does not have Windows NT or Windows 2000. You cannot watch a remote Windows NT 4.0 computer from a Windows NT 4.0 computer. The property is set by default to watch all files.
-
+> The component will not watch the specified directory until the is set, and is `true`.
+
+ The component can watch files on your personal computer, a network drive, or a remote computer.
+
+ You cannot watch a remote computer that does not have Windows NT or Windows 2000. You cannot watch a remote Windows NT 4.0 computer from a Windows NT 4.0 computer. The property is set by default to watch all files.
+
]]>
The parameter is .
- The parameter is an empty string ("").
-
- -or-
-
+ The parameter is an empty string ("").
+
+ -or-
+
The path specified through the parameter does not exist.
is too long.
@@ -371,28 +319,28 @@
The type of files to watch. For example, "*.txt" watches for changes to all text files.
Initializes a new instance of the class, given the specified directory and type of files to monitor.
- [!NOTE]
-> The component will not watch the specified directory until the is set, and is `true`.
-
- The component can watch files on your personal computer, a network drive, or a remote computer.
-
- You cannot watch a remote computer that does not have Windows NT or Windows 2000. You cannot watch a remote Windows NT 4.0 computer from a Windows NT 4.0 computer.
-
+> The component will not watch the specified directory until the is set, and is `true`.
+
+ The component can watch files on your personal computer, a network drive, or a remote computer.
+
+ You cannot watch a remote computer that does not have Windows NT or Windows 2000. You cannot watch a remote Windows NT 4.0 computer from a Windows NT 4.0 computer.
+
]]>
- The parameter is .
-
- -or-
-
+ The parameter is .
+
+ -or-
+
The parameter is .
- The parameter is an empty string ("").
-
- -or-
-
+ The parameter is an empty string ("").
+
+ -or-
+
The path specified through the parameter does not exist.
is too long.
@@ -448,11 +396,11 @@
Begins the initialization of a used on a form or used by another component. The initialization occurs at run time.
- method ends the initialization. Using the and methods prevents the control from being used before it is fully initialized.
-
+ method ends the initialization. Using the and methods prevents the control from being used before it is fully initialized.
+
]]>
@@ -506,31 +454,31 @@
Occurs when a file or directory in the specified is changed.
- event is raised when changes are made to the size, system attributes, last write time, last access time, or security permissions of a file or directory in the directory being monitored.
-
+ event is raised when changes are made to the size, system attributes, last write time, last access time, or security permissions of a file or directory in the directory being monitored.
+
> [!NOTE]
-> Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
-
- Use to restrict the number of notifications raised when this event is handled.
-
+> Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
+
+ Use to restrict the number of notifications raised when this event is handled.
+
> [!NOTE]
-> The event is raised unexpectedly when a file is renamed, but is not raised when a directory is renamed. To watch for renaming, use the event.
-
+> The event is raised unexpectedly when a file is renamed, but is not raised when a directory is renamed. To watch for renaming, use the event.
+
> [!NOTE]
-> The order in which the event is raised in relation to the other events may change when the property is not `null`.
-
-
-
-## Examples
- The following example uses the event to display the file path to the console whenever the watched file is changed.
-
+> The order in which the event is raised in relation to the other events may change when the property is not `null`.
+
+
+
+## Examples
+ The following example uses the event to display the file path to the console whenever the watched file is changed.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -588,28 +536,28 @@
Occurs when a file or directory in the specified is created.
- event in the directory to which the file was copied, if that directory is being watched. If the directory from which you copied was being watched by another instance of , no event would be raised. For example, you create two instances of . FileSystemWatcher1 is set to watch "C:\My Documents", and FileSystemWatcher2 is set to watch "C:\Your Documents". If you copy a file from "My Documents" into "Your Documents", a event will be raised by FileSystemWatcher2, but no event is raised for FileSystemWatcher1. Unlike copying, moving a file or directory would raise two events. From the previous example, if you moved a file from "My Documents" to "Your Documents", a event would be raised by FileSystemWatcher2 and a event would be raised by FileSystemWatcher1.
-
+ event in the directory to which the file was copied, if that directory is being watched. If the directory from which you copied was being watched by another instance of , no event would be raised. For example, you create two instances of . FileSystemWatcher1 is set to watch "C:\My Documents", and FileSystemWatcher2 is set to watch "C:\Your Documents". If you copy a file from "My Documents" into "Your Documents", a event will be raised by FileSystemWatcher2, but no event is raised for FileSystemWatcher1. Unlike copying, moving a file or directory would raise two events. From the previous example, if you moved a file from "My Documents" to "Your Documents", a event would be raised by FileSystemWatcher2 and a event would be raised by FileSystemWatcher1.
+
> [!NOTE]
-> Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
-
+> Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
+
> [!NOTE]
-> The order in which the event is raised in relation to the other events may change when the property is not `null`.
-
- The event is raised as soon as a file is created. If a file is being copied or transferred into a watched directory, the event will be raised immediately, followed by one or more events.
-
-
-
-## Examples
- The following example uses the event to display the file path to the console whenever the watched file is created.
-
+> The order in which the event is raised in relation to the other events may change when the property is not `null`.
+
+ The event is raised as soon as a file is created. If a file is being copied or transferred into a watched directory, the event will be raised immediately, followed by one or more events.
+
+
+
+## Examples
+ The following example uses the event to display the file path to the console whenever the watched file is created.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -668,26 +616,26 @@
Occurs when a file or directory in the specified is deleted.
- event in the directory to which the file was copied, if that directory is being watched. If the directory from which you copied was being watched by another instance of , no event would be raised. For example, you create two instances of . FileSystemWatcher1 is set to watch "C:\My Documents", and FileSystemWatcher2 is set to watch "C:\Your Documents". If you copy a file from "My Documents" into "Your Documents", a event will be raised by FileSystemWatcher2, but no event is raised for FileSystemWatcher1. Unlike copying, moving a file or directory would raise two events. From the previous example, if you moved a file from "My Documents" to "Your Documents", a event would be raised by FileSystemWatcher2 and a event would be raised by FileSystemWatcher1.
-
+ event in the directory to which the file was copied, if that directory is being watched. If the directory from which you copied was being watched by another instance of , no event would be raised. For example, you create two instances of . FileSystemWatcher1 is set to watch "C:\My Documents", and FileSystemWatcher2 is set to watch "C:\Your Documents". If you copy a file from "My Documents" into "Your Documents", a event will be raised by FileSystemWatcher2, but no event is raised for FileSystemWatcher1. Unlike copying, moving a file or directory would raise two events. From the previous example, if you moved a file from "My Documents" to "Your Documents", a event would be raised by FileSystemWatcher2 and a event would be raised by FileSystemWatcher1.
+
> [!NOTE]
-> Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
-
+> Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
+
> [!NOTE]
-> The order in which the event is raised in relation to the other events may change when the property is not `null`.
-
-
-
-## Examples
- The following example uses the event to display the file path to the console whenever the watched file is deleted.
-
+> The order in which the event is raised in relation to the other events may change when the property is not `null`.
+
+
+
+## Examples
+ The following example uses the event to display the file path to the console whenever the watched file is deleted.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -779,19 +727,19 @@
to release both managed and unmanaged resources; to release only unmanaged resources.
Releases the unmanaged resources used by the and optionally releases the managed resources.
- method and the method, if it has been overridden. invokes the protected method with the `disposing` parameter set to `true`. `Finalize` invokes with `disposing` set to `false`.
-
- When the `disposing` parameter is `true`, this method releases all resources held by any managed objects that this references. This method invokes the method of each referenced object.
-
+ method and the method, if it has been overridden. invokes the protected method with the `disposing` parameter set to `true`. `Finalize` invokes with `disposing` set to `false`.
+
+ When the `disposing` parameter is `true`, this method releases all resources held by any managed objects that this references. This method invokes the method of each referenced object.
+
]]>
- can be called multiple times by other objects. When overriding be careful not to reference objects that have been previously disposed of in an earlier call to . For more information about how to implement , see [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).
-
+ can be called multiple times by other objects. When overriding be careful not to reference objects that have been previously disposed of in an earlier call to . For more information about how to implement , see [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).
+
For more information about and , see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged).
@@ -853,25 +801,25 @@
if the component is enabled; otherwise, . The default is . If you are using the component on a designer in Visual Studio 2005, the default is .
- to `true`.
-
+ to `true`.
+
> [!NOTE]
-> The component will not watch the specified directory until the property has been set and is `true`.
-
- The method allows event handlers to be invoked to respond to file changes even if this property is set to `false`.
-
-
-
-## Examples
- The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
-
+> The component will not watch the specified directory until the property has been set and is `true`.
+
+ The method allows event handlers to be invoked to respond to file changes even if this property is set to `false`.
+
+
+
+## Examples
+ The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
The object has been disposed.
@@ -921,11 +869,11 @@
Ends the initialization of a used on a form or used by another component. The initialization occurs at run time.
- method starts the initialization. Using the and methods prevents the control from being used before it is fully initialized.
-
+ method starts the initialization. Using the and methods prevents the control from being used before it is fully initialized.
+
]]>
@@ -975,16 +923,16 @@
Occurs when the instance of is unable to continue monitoring changes or when the internal buffer overflows.
- object from monitoring changes. For example, if the object is monitoring changes in a remote directory and the connection to that directory is lost, the event is raised.
-
- The system notifies you of file changes, and it stores those changes in a buffer that the component creates and passes to the APIs. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. Increasing the size of the buffer is expensive, because it comes from non paged memory that cannot be swapped out to disk, so keep the buffer as small as possible. To avoid a buffer overflow, use the , , and properties to filter out unwanted change notifications.
-
+ object from monitoring changes. For example, if the object is monitoring changes in a remote directory and the connection to that directory is lost, the event is raised.
+
+ The system notifies you of file changes, and it stores those changes in a buffer that the component creates and passes to the APIs. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. Increasing the size of the buffer is expensive, because it comes from non paged memory that cannot be swapped out to disk, so keep the buffer as small as possible. To avoid a buffer overflow, use the , , and properties to filter out unwanted change notifications.
+
> [!NOTE]
-> Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
-
+> Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several and some and events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by .
+
]]>
@@ -1083,35 +1031,35 @@
Gets or sets the filter string used to determine what files are monitored in a directory.
The filter string. The default is "*.\*" (Watches all files.)
- property to an empty string (""). To watch a specific file, set the property to the file name. For example, to watch for changes in the file MyDoc.txt, set the property to "MyDoc.txt". You can also watch for changes in a certain type of file. For example, to watch for changes in any text files, set the property to "*.txt". Use of multiple filters such as "\*.txt|\*.doc" is not supported.
-
- The property can be changed after the object has started receiving events.
-
- For more information about filtering out unwanted notifications, see the , , and properties.
-
- accepts wildcards for matching files, as shown in the following examples.
-
-|Filter string|Watches the following files|
-|-------------------|---------------------------------|
-|*.\*|All files (default). An empty string ("") also watches all files.|
-|*.txt|All files with a "txt" extension.|
-|*recipe.doc|All files ending in "recipe" with a "doc" extension.|
-|win*.xml|All files beginning with "win" with an "xml" extension.|
-|Sales*200?.xls|Matches the following:
- Sales July 2001.xls
- Sales Aug 2002.xls
- Sales March 2004.xls
but does not match:
- Sales Nov 1999.xls|
-|MyReport.Doc|Watches only MyReport.doc|
-
-
-
-## Examples
- The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
-
+ property to an empty string (""). To watch a specific file, set the property to the file name. For example, to watch for changes in the file MyDoc.txt, set the property to "MyDoc.txt". You can also watch for changes in a certain type of file. For example, to watch for changes in any text files, set the property to "*.txt". Use of multiple filters such as "\*.txt|\*.doc" is not supported.
+
+ The property can be changed after the object has started receiving events.
+
+ For more information about filtering out unwanted notifications, see the , , and properties.
+
+ accepts wildcards for matching files, as shown in the following examples.
+
+|Filter string|Watches the following files|
+|-------------------|---------------------------------|
+|*.\*|All files (default). An empty string ("") also watches all files.|
+|*.txt|All files with a "txt" extension.|
+|*recipe.doc|All files ending in "recipe" with a "doc" extension.|
+|win*.xml|All files beginning with "win" with an "xml" extension.|
+|Sales*200?.xls|Matches the following:
- Sales July 2001.xls
- Sales Aug 2002.xls
- Sales March 2004.xls
but does not match:
- Sales Nov 1999.xls|
+|MyReport.Doc|Watches only MyReport.doc|
+
+
+
+## Examples
+ The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -1251,15 +1199,15 @@
if you want to monitor subdirectories; otherwise, . The default is .
- to `true` when you want to watch for change notifications for files and directories contained within the directory specified through the property, and its subdirectories. Setting the property to `false` helps reduce the number of notifications sent to the internal buffer. For more information on filtering out unwanted notifications, see the and properties.
-
- When `true`, is recursive through the entire subtree, not just the immediate child directories. The relative path to a file or directory within the subtree returns in the property of and the property of , depending on changes you are watching for. You can get the fully qualified path from the property of and the property of , depending on the changes you are watching for.
-
- If a directory is created in the subtree of the directory you are watching, and is `true`, that directory will automatically be watched.
-
+ to `true` when you want to watch for change notifications for files and directories contained within the directory specified through the property, and its subdirectories. Setting the property to `false` helps reduce the number of notifications sent to the internal buffer. For more information on filtering out unwanted notifications, see the and properties.
+
+ When `true`, is recursive through the entire subtree, not just the immediate child directories. The relative path to a file or directory within the subtree returns in the property of and the property of , depending on changes you are watching for. You can get the fully qualified path from the property of and the property of , depending on the changes you are watching for.
+
+ If a directory is created in the subtree of the directory you are watching, and is `true`, that directory will automatically be watched.
+
]]>
@@ -1326,13 +1274,13 @@
Gets or sets the size (in bytes) of the internal buffer.
The internal buffer size in bytes. The default is 8192 (8 KB).
- property to less than 4096 bytes, your value is discarded and the property is set to 4096 bytes. For best performance, use a multiple of 4 KB on Intel-based computers.
-
- The system notifies the component of file changes, and it stores those changes in a buffer the component creates and passes to the APIs. Each event can use up to 16 bytes of memory, not including the file name. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. Increasing the size of the buffer can prevent missing file system change events. However, increasing buffer size is expensive, because it comes from non-paged memory that cannot be swapped out to disk, so keep the buffer as small as possible. To avoid a buffer overflow, use the and properties to filter out unwanted change notifications.
-
+ property to less than 4096 bytes, your value is discarded and the property is set to 4096 bytes. For best performance, use a multiple of 4 KB on Intel-based computers.
+
+ The system notifies the component of file changes, and it stores those changes in a buffer the component creates and passes to the APIs. Each event can use up to 16 bytes of memory, not including the file name. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. Increasing the size of the buffer can prevent missing file system change events. However, increasing buffer size is expensive, because it comes from non-paged memory that cannot be swapped out to disk, so keep the buffer as small as possible. To avoid a buffer overflow, use the and properties to filter out unwanted change notifications.
+
]]>
@@ -1398,22 +1346,22 @@
Gets or sets the type of changes to watch for.
One of the values. The default is the bitwise OR combination of , , and .
- enumeration to watch for more than one type of change at a time. For example, you can watch for changes in size of a file, and for changes in the `LastWrite` time. This raises an event anytime there is a change in file or folder size, or a change in the `LastWrite` time of the file or folder.
-
- This is one way to filter out unwanted notifications. For more information on filtering out unwanted notifications, see the , , and properties.
-
-
-
-## Examples
- The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
-
+ enumeration to watch for more than one type of change at a time. For example, you can watch for changes in size of a file, and for changes in the `LastWrite` time. This raises an event anytime there is a change in file or folder size, or a change in the `LastWrite` time of the file or folder.
+
+ This is one way to filter out unwanted notifications. For more information on filtering out unwanted notifications, see the , , and properties.
+
+
+
+## Examples
+ The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
The value is not a valid bitwise OR combination of the values.
@@ -1471,17 +1419,17 @@
A that contains the event data.
Raises the event.
- is called when changes are made to the size, system attributes, last write time, last access time, or security permissions of a file or directory in the directory being monitored.
-
- Use the property to restrict the number of events raised when the event is handled.
-
- The event is raised as soon as a file is created. If a file is being copied or transferred into a watched directory, the event will be raised immediately, followed by one or more events.
-
- Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
-
+ is called when changes are made to the size, system attributes, last write time, last access time, or security permissions of a file or directory in the directory being monitored.
+
+ Use the property to restrict the number of events raised when the event is handled.
+
+ The event is raised as soon as a file is created. If a file is being copied or transferred into a watched directory, the event will be raised immediately, followed by one or more events.
+
+ Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
+
]]>
@@ -1540,17 +1488,17 @@
A that contains the event data.
Raises the event.
- is called when a file or directory is created in the directory being monitored.
-
- Some common occurrences, such as copying or moving a file or directory, do not correspond directly to an event, but these occurrences do cause events to be raised. When you copy a file or directory, the system raises a event in the directory to which the file was copied, if that directory is being watched. If the directory from which you copied was being watched by another instance of , no event would be raised. For example, you create two instances of . FileSystemWatcher1 is set to watch "C:\My Documents", and FileSystemWatcher2 is set to watch "C:\Your Documents". If you copy a file from "My Documents" and paste it into "Your Documents", a event will be raised in FileSystemWatcher2, but no event is raised for FileSystemWatcher1. Unlike copying, moving a file or directory raises two events. From the previous example, if you moved a file from "My Documents" to "Your Documents", a event would be raised in FileSystemWatcher2 and a event would be raised in FileSystemWatcher1.
-
- The event is raised as soon as a file is created. If a file is being copied or transferred into a watched directory, the event will be raised immediately, followed by one or more events.
-
- Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
-
+ is called when a file or directory is created in the directory being monitored.
+
+ Some common occurrences, such as copying or moving a file or directory, do not correspond directly to an event, but these occurrences do cause events to be raised. When you copy a file or directory, the system raises a event in the directory to which the file was copied, if that directory is being watched. If the directory from which you copied was being watched by another instance of , no event would be raised. For example, you create two instances of . FileSystemWatcher1 is set to watch "C:\My Documents", and FileSystemWatcher2 is set to watch "C:\Your Documents". If you copy a file from "My Documents" and paste it into "Your Documents", a event will be raised in FileSystemWatcher2, but no event is raised for FileSystemWatcher1. Unlike copying, moving a file or directory raises two events. From the previous example, if you moved a file from "My Documents" to "Your Documents", a event would be raised in FileSystemWatcher2 and a event would be raised in FileSystemWatcher1.
+
+ The event is raised as soon as a file is created. If a file is being copied or transferred into a watched directory, the event will be raised immediately, followed by one or more events.
+
+ Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
+
]]>
@@ -1609,15 +1557,15 @@
A that contains the event data.
Raises the event.
- is called when a file or directory, within the directory being monitored, is deleted.
-
- Some common occurrences, such as copying or moving a file or directory, do not correspond directly to an event, but these occurrences do cause events to be raised. When you copy a file or directory, the system raises a event in the directory to which the file was copied, if that directory is being watched. If the directory from which you copied was being watched by another instance of , no event would be raised. For example, you create two instances of . FileSystemWatcher1 is set to watch "C:\My Documents", and FileSystemWatcher2 is set to watch "C:\Your Documents". If you copy a file from "My Documents" into "Your Documents", a event will be raised by FileSystemWatcher2, but no event is raised for FileSystemWatcher1. Unlike copying, moving a file or directory raises two events. From the previous example, if you moved a file from "My Documents" to "Your Documents", a event would be raised by FileSystemWatcher2 and a event would be raised by FileSystemWatcher1.
-
- Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
-
+ is called when a file or directory, within the directory being monitored, is deleted.
+
+ Some common occurrences, such as copying or moving a file or directory, do not correspond directly to an event, but these occurrences do cause events to be raised. When you copy a file or directory, the system raises a event in the directory to which the file was copied, if that directory is being watched. If the directory from which you copied was being watched by another instance of , no event would be raised. For example, you create two instances of . FileSystemWatcher1 is set to watch "C:\My Documents", and FileSystemWatcher2 is set to watch "C:\Your Documents". If you copy a file from "My Documents" into "Your Documents", a event will be raised by FileSystemWatcher2, but no event is raised for FileSystemWatcher1. Unlike copying, moving a file or directory raises two events. From the previous example, if you moved a file from "My Documents" to "Your Documents", a event would be raised by FileSystemWatcher2 and a event would be raised by FileSystemWatcher1.
+
+ Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
+
]]>
@@ -1676,13 +1624,13 @@
An that contains the event data.
Raises the event.
- is called when an error occurs.
-
- Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
-
+ is called when an error occurs.
+
+ Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
+
]]>
@@ -1741,13 +1689,13 @@
A that contains the event data.
Raises the event.
- is called when a file or directory within the directory being monitored is renamed. Its argument contains information about the renaming operation, such as the type of change, the old and new path, and the old and new name. Note that its property may be null for renamed events if the does not get matching old and new name events from the operating system.
-
- Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
-
+ is called when a file or directory within the directory being monitored is renamed. Its argument contains information about the renaming operation, such as the type of change, the old and new path, and the old and new name. Note that its property may be null for renamed events if the does not get matching old and new name events from the operating system.
+
+ Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/).
+
]]>
@@ -1858,37 +1806,37 @@
Gets or sets the path of the directory to watch.
The path to monitor. The default is an empty string ("").
- property is `true`, this directory is the root at which the system watches for changes; otherwise it is the only directory watched. To watch a specific file, set the property to the fully qualified, correct directory, and the property to the file name.
-
- The property supports Universal Naming Convention (UNC) paths.
-
+ property is `true`, this directory is the root at which the system watches for changes; otherwise it is the only directory watched. To watch a specific file, set the property to the fully qualified, correct directory, and the property to the file name.
+
+ The property supports Universal Naming Convention (UNC) paths.
+
> [!NOTE]
-> This property must be set before the component can watch for changes.
-
- When a directory is renamed, the automatically reattaches itself to the newly renamed item. For example, if you set the property to "C:\My Documents" and then manually rename the directory to "C:\Your Documents", the component continues listening for change notifications on the newly renamed directory. However, when you ask for the property, it contains the old path. This happens because the component determines what directory watches based on the handle, rather than the name of the directory. Renaming does not affect the handle. So, if you destroy the component, and then recreate it without updating the property, your application will fail because the directory no longer exists.
-
-
-
-## Examples
- The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
-
+> This property must be set before the component can watch for changes.
+
+ When a directory is renamed, the automatically reattaches itself to the newly renamed item. For example, if you set the property to "C:\My Documents" and then manually rename the directory to "C:\Your Documents", the component continues listening for change notifications on the newly renamed directory. However, when you ask for the property, it contains the old path. This happens because the component determines what directory watches based on the handle, rather than the name of the directory. Renaming does not affect the handle. So, if you destroy the component, and then recreate it without updating the property, your application will fail because the directory no longer exists.
+
+
+
+## Examples
+ The following example creates a to watch the directory specified at run time. The component is set to watch for changes in `LastWrite` and `LastAccess` time, the creation, deletion, or renaming of text files in the directory. If a file is changed, created, or deleted, the path to the file prints to the console. When a file is renamed, the old and new paths print to the console.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
- The specified path does not exist or could not be found.
-
- -or-
-
- The specified path contains wildcard characters.
-
- -or-
-
+ The specified path does not exist or could not be found.
+
+ -or-
+
+ The specified path contains wildcard characters.
+
+ -or-
+
The specified path contains invalid path characters.
@@ -1942,9 +1890,9 @@
Occurs when a file or directory in the specified is renamed.
- delegate that has the following signature:
```csharp
@@ -1955,17 +1903,17 @@ Public Delegate Sub RenamedEventHandler(sender As Object, e As RenamedEventArgs)
```
The object provides information about the renaming operation, such as the type of the rename (the property), the old and new name, and the old and new path. Note that the property may be null for renamed events if the does not get matching old and new name events from the operating system.
- Renaming the directory you are watching will not raise a notification. Notifications are only raised for entries inside the directory you are watching.
-
-
-
-## Examples
- The following example uses the event to display the file path to the console whenever the watched file is renamed.
-
+ Renaming the directory you are watching will not raise a notification. Notifications are only raised for entries inside the directory you are watching.
+
+
+
+## Examples
+ The following example uses the event to display the file path to the console whenever the watched file is renamed.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.IO/FileSystemWatcher/Overview/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic NotifyFilters Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -2019,11 +1967,11 @@ Public Delegate Sub RenamedEventHandler(sender As Object, e As RenamedEventArgs)
Gets or sets an for the .
An for the .
- to a and enable communication between them, as well as provide a way for the container to manage its components.
-
+ to a and enable communication between them, as well as provide a way for the container to manage its components.
+
]]>
@@ -2088,15 +2036,15 @@ Public Delegate Sub RenamedEventHandler(sender As Object, e As RenamedEventArgs)
Gets or sets the object used to marshal the event handler calls issued as a result of a directory change.
The that represents the object used to marshal the event handler calls issued as a result of a directory change. The default is .
- is `null`, methods handling the , , , and events are called on a thread from the system thread pool. For more information on system thread pools, see .
-
- When the , , , and events are handled by a visual Windows Forms component, such as a , accessing the component through the system thread pool might not work, or may result in an exception. Avoid this by setting to a Windows Forms component, which causes the methods that handle the , , , and events to be called on the same thread on which the component was created.
-
- If the is used inside Visual Studio 2005 in a Windows Forms designer, automatically sets to the control that contains the . For example, if you place a on a designer for Form1 (which inherits from ) the property of is set to the instance of Form1.
-
+ is `null`, methods handling the , , , and events are called on a thread from the system thread pool. For more information on system thread pools, see .
+
+ When the , , , and events are handled by a visual Windows Forms component, such as a , accessing the component through the system thread pool might not work, or may result in an exception. Avoid this by setting to a Windows Forms component, which causes the methods that handle the , , , and events to be called on the same thread on which the component was created.
+
+ If the is used inside Visual Studio 2005 in a Windows Forms designer, automatically sets to the control that contains the . For example, if you place a on a designer for Form1 (which inherits from ) the property of is set to the instance of Form1.
+
]]>
@@ -2160,16 +2108,16 @@ Public Delegate Sub RenamedEventHandler(sender As Object, e As RenamedEventArgs)
A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor.
A that contains specific information on the change that occurred.
- with the `timeout` parameter set to -1.
-
+ with the `timeout` parameter set to -1.
+
> [!NOTE]
-> This method allows an event handler to be invoked to respond to file changes even if the property is set to `false`.
-
- In some systems, reports changes to files using the short 8.3 file name format. For example, a change to "LongFileName.LongExtension" could be reported as "LongFi~.Lon".
-
+> This method allows an event handler to be invoked to respond to file changes even if the property is set to `false`.
+
+ In some systems, reports changes to files using the short 8.3 file name format. For example, a change to "LongFileName.LongExtension" could be reported as "LongFi~.Lon".
+
]]>
@@ -2219,16 +2167,16 @@ Public Delegate Sub RenamedEventHandler(sender As Object, e As RenamedEventArgs)
A synchronous method that returns a structure that contains specific information on the change that occurred, given the type of change you want to monitor and the time (in milliseconds) to wait before timing out.
A that contains specific information on the change that occurred.
- [!NOTE]
-> This method allows an event handler to be invoked to respond to file changes even if the property is set to `false`.
-
- In some systems, reports changes to files using the short 8.3 file name format. For example, a change to "LongFileName.LongExtension" could be reported as "LongFi~.Lon".
-
+> This method allows an event handler to be invoked to respond to file changes even if the property is set to `false`.
+
+ In some systems, reports changes to files using the short 8.3 file name format. For example, a change to "LongFileName.LongExtension" could be reported as "LongFi~.Lon".
+
]]>
diff --git a/xml/System.Linq.Expressions/BinaryExpression.xml b/xml/System.Linq.Expressions/BinaryExpression.xml
index 6bbabcd2270..d67c6473572 100644
--- a/xml/System.Linq.Expressions/BinaryExpression.xml
+++ b/xml/System.Linq.Expressions/BinaryExpression.xml
@@ -60,83 +60,15 @@
Represents an expression that has a binary operator.
-
- that has a specific node type, represented by the property. Each table contains information for a specific class of operations such as arithmetic or bitwise.
-
-## Binary Arithmetic Operations
-
-|Node Type|Factory Method|
-|---------------|--------------------|
-|||
-|||
-|||
-|||
-|||
-|||
-|||
-|||
-|||
-
-## Bitwise Operations
-
-|Node Type|Factory Method|
-|---------------|--------------------|
-|||
-|||
-|||
-
-## Shift Operations
-
-|Node Type|Factory Method|
-|---------------|--------------------|
-|||
-|||
-
-## Conditional Boolean Operations
-
-|Node Type|Factory Method|
-|---------------|--------------------|
-|||
-|||
-
-## Comparison Operations
-
-|Node Type|Factory Method|
-|---------------|--------------------|
-|||
-|||
-|||
-|||
-|||
-|||
-
-## Coalescing Operations
-
-|Node Type|Factory Method|
-|---------------|--------------------|
-|||
-
-## Array Indexing Operations
-
-|Node Type|Factory Method|
-|---------------|--------------------|
-|||
-
- In addition, the methods can also be used to create a . These factory methods can be used to create a of any node type that represents a binary operation. The parameter of these methods that is of type specifies the desired node type.
-
-
-
-## Examples
- The following example creates a object that represents the subtraction of one number from another.
-
- :::code language="csharp" source="~/snippets/csharp/System.Linq.Expressions/BinaryExpression/Overview/Expression.cs" id="Snippet8":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Linq.Expressions.Expression/VB/Expression.vb" id="Snippet8":::
-
- ]]>
-
+
+ object that represents the subtraction of one number from another.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Linq.Expressions/BinaryExpression/Overview/Expression.cs" id="Snippet8":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Linq.Expressions.Expression/VB/Expression.vb" id="Snippet8":::
+ ]]>
+
+ For more information about this API, see Supplemental API remarks for BinaryExpression.
@@ -181,11 +113,11 @@
Dispatches to the specific visit method for this node type. For example, calls the .
The result of visiting this node.
- nodes calls . Override this method to call into a more specific method on a derived visitor class of the class. However, it should still support unknown visitors by calling .
-
+ nodes calls . Override this method to call into a more specific method on a derived visitor class of the class. However, it should still support unknown visitors by calling .
+
]]>
@@ -285,11 +217,11 @@
Gets the type conversion function that is used by a coalescing or compound assignment operation.
A that represents a type conversion function.
- property is `null` for any whose property is not .
-
+ property is `null` for any whose property is not .
+
]]>
@@ -334,11 +266,11 @@
if the node represents a lifted call; otherwise, .
-
@@ -383,11 +315,11 @@
if the operator's return type is lifted to a nullable type; otherwise, .
- is `true`, the operator returns a nullable type, and if a nullable operand evaluates to `null`, the operator returns `null`.
-
+ is `true`, the operator returns a nullable type, and if a nullable operand evaluates to `null`, the operator returns `null`.
+
]]>
@@ -493,11 +425,11 @@
Gets the implementing method for the binary operation.
The that represents the implementing method.
- represents an operation that uses a predefined operator, the property is `null`.
-
+ represents an operation that uses a predefined operator, the property is `null`.
+
]]>
@@ -541,13 +473,13 @@
Reduces the binary expression node to a simpler expression.
The reduced expression.
-
diff --git a/xml/System.Net.Http/HttpClient.xml b/xml/System.Net.Http/HttpClient.xml
index 060ffee389b..550c255e5a9 100644
--- a/xml/System.Net.Http/HttpClient.xml
+++ b/xml/System.Net.Http/HttpClient.xml
@@ -45,160 +45,14 @@
Provides a class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.
-
- class instance acts as a session to send HTTP requests. An instance is a collection of settings applied to all requests executed by that instance. In addition, every instance uses its own connection pool, isolating its requests from requests executed by other instances.
-
-### Instancing
-
- is intended to be instantiated once and reused throughout the life of an application. In .NET Core and .NET 5+, HttpClient pools connections inside the handler instance and reuses a connection across multiple requests. If you instantiate an HttpClient class for every request, the number of sockets available under heavy loads will be exhausted. This exhaustion will result in errors.
-
-You can configure additional options by passing in a "handler", such as (or in .NET Core 2.1 or later), as part of the constructor. The connection properties on the handler cannot be changed once a request has been submitted, so one reason to create a new HttpClient instance would be if you need to change the connection properties. If different requests require different settings, this may also lead to an application having multiple instances, where each instance is configured appropriately, and then requests are issued on the relevant client.
-
-HttpClient only resolves DNS entries when a connection is created. It does not track any time to live (TTL) durations specified by the DNS server. If DNS entries change regularly, which can happen in some container scenarios, the client won't respect those updates. To solve this issue, you can limit the lifetime of the connection by setting the property, so that DNS lookup is required when the connection is replaced.
-
-```csharp
-public class GoodController : ApiController
-{
- private static readonly HttpClient httpClient;
-
- static GoodController()
- {
- var socketsHandler = new SocketsHttpHandler
- {
- PooledConnectionLifetime = TimeSpan.FromMinutes(2)
- };
-
- httpClient = new HttpClient(socketsHandler);
- }
-}
-```
-
-As an alternative to creating only one HttpClient instance, you can also use to manage the HttpClient instances for you. For more information, see [Guidelines for using HttpClient](/dotnet/fundamentals/networking/httpclient-guidelines).
-
-### Derivation
-
- The also acts as a base class for more specific HTTP clients. An example would be a FacebookHttpClient that provides additional methods specific to a Facebook web service (for example, a `GetFriends` method). Derived classes should not override the virtual methods on the class. Instead, use a constructor overload that accepts to configure any pre-request or post-request processing.
-
-### Transports
-
-The is a high-level API that wraps the lower-level functionality available on each platform where it runs.
-
-On each platform, tries to use the best available transport:
-
-| **Host/Runtime** | **Backend** |
-| --------------------------- | ----------------------------------------------------------------------------------------- |
-| Windows/.NET Framework | |
-| Windows/Mono | |
-| Windows/UWP | Windows native (HTTP 2.0 capable) |
-| Windows/.NET Core 1.0-2.0 | Windows native (HTTP 2.0 capable) |
-| Android/Xamarin | Selected at build-time. Can either use or be configured to use Android's native [`HttpURLConnection`](https://developer.xamarin.com/api/type/Java.Net.HttpURLConnection/) |
-| iOS, tvOS, watchOS/Xamarin | Selected at build-time. Can either use or be configured to use Apple's [`NSUrlSession`](https://developer.xamarin.com/api/type/MonoTouch.Foundation.NSUrlSession/) (HTTP 2.0 capable) |
-| macOS/Xamarin | Selected at build-time. Can either use or be configured to use Apple's [`NSUrlSession`](https://developer.xamarin.com/api/type/MonoTouch.Foundation.NSUrlSession/) (HTTP 2.0 capable) |
-| macOS/Mono | |
-| macOS/.NET Core 1.0-2.0 | `libcurl`-based HTTP transport (HTTP 2.0 capable) |
-| Linux/Mono | |
-| Linux/.NET Core 1.0-2.0 | `libcurl`-based HTTP transport (HTTP 2.0 capable) |
-| .NET Core 2.1 and later | |
-
-Users can also configure a specific transport for by invoking the constructor that takes an .
-
-#### .NET Framework & Mono
-
- By default on .NET Framework and Mono, is used to send requests to the server. This behavior can be modified by specifying a different handler in one of the constructor overloads with an parameter. If you require features like authentication or caching, you can use to configure settings and the instance can be passed to the constructor. The returned handler can be passed to a constructor overload that has an parameter.
-
-#### .NET Core
-
-Starting with .NET Core 2.1, the class instead of provides the implementation used by higher-level HTTP networking classes such as . The use of offers a number of advantages:
-
-- A significant performance improvement when compared with the previous implementation.
-- The elimination of platform dependencies, which simplifies deployment and servicing. For example, `libcurl` is no longer a dependency on .NET Core for macOS and .NET Core for Linux.
-- Consistent behavior across all .NET platforms.
-
-If this change is undesirable, on Windows you can continue to use by referencing its [NuGet package](https://www.nuget.org/packages/System.Net.Http.WinHttpHandler/) and passing it to [HttpClient's constructor](xref:System.Net.Http.HttpClient.%23ctor(System.Net.Http.HttpMessageHandler)) manually.
-
-### Configure behavior using runtime configuration options
-
-Certain aspects of 's behavior are customizable through [Runtime configuration options](/dotnet/core/run-time-config/networking). However, the behavior of these switches differs through .NET versions. For example, in .NET Core 2.1 - 3.1, you can configure whether is used by default, but that option is no longer available starting in .NET 5.0.
-
-### Connection pooling
-
-HttpClient pools HTTP connections where possible and uses them for more than one request. This can have a significant performance benefit, especially for HTTPS requests, as the connection handshake is only done once.
-
-Connection pool properties can be configured on a or passed in during construction, including , , and .
-
-Disposing of the HttpClient instance closes the open connections and cancels any pending requests.
-
-> [!NOTE]
-> If you concurrently send HTTP/1.1 requests to the same server, new connections can be created. Even if you reuse the `HttpClient` instance, if the rate of requests is high, or if there are any firewall limitations, that can exhaust the available sockets because of default TCP cleanup timers. To limit the number of concurrent connections, you can set the `MaxConnectionsPerServer` property. By default, the number of concurrent HTTP/1.1 connections is unlimited.
-
-### Buffering and request lifetime
-
-By default, HttpClient methods (except ) buffer the responses from the server, reading all the response body into memory before returning the async result. Those requests will continue until one of the following occurs:
-
-* The succeeds and returns a result.
-* The is reached, in which case the will be cancelled.
-* The passable to some method overloads is fired.
-* is called.
-* The HttpClient is disposed.
-
-You can change the buffering behavior on a per-request basis using the parameter available on some method overloads. This argument can be used to specify if the should be considered complete after reading just the response headers, or after reading and buffering the response content.
-
-If your app that uses and related classes in the namespace intends to download large amounts of data (50 megabytes or more), then the app should stream those downloads and not use the default buffering. If you use the default buffering, the client memory usage will get very large, potentially resulting in substantially reduced performance.
-
-### Thread safety
-
- The following methods are thread safe:
-
--
--
--
--
--
--
--
--
--
-
-### Proxies
-
-By default, HttpClient reads proxy configuration from environment variables or user/system settings, depending on the platform. You can change this behavior by passing a or to, in order of precedence:
-
-* The property on a HttpClientHandler passed in during HttpClient construction
-* The static property (affects all instances)
-
-You can disable the proxy using . The default configuration for Windows users is to try and detect a proxy using network discovery, which can be slow. For high throughput applications where it's known that a proxy isn't required, you should disable the proxy.
-
-Proxy settings (like ) should be changed only before the first request is made using the HttpClient. Changes made after using the HttpClient for the first time may not be reflected in subsequent requests.
-
-### Timeouts
-
-You can use to set a default timeout for all HTTP requests from the HttpClient instance. The timeout only applies to the xxxAsync methods that cause a request/response to be initiated. If the timeout is reached, the for that request is cancelled.
-
-You can set some additional timeouts if you pass in a instance when constructing the HttpClient object:
-
-| **Property** | **Description**|
-| ------------ | -------------- |
-| | Specifies a timeout that's used when a request requires a new TCP connection to be created. If the timeout occurs, the request is cancelled. |
-| | Specifies a timeout to be used for each connection in the connection pool. If the connection is idle, the connection is immediately closed; otherwise, the connection is closed at the end of the current request. |
-| | If a connection in the connection pool is idle for this long, the connection is closed. |
-| | If request has an "Expect: 100-continue" header, it delays sending content until the timeout or until a "100-continue" response is received. |
-
-HttpClient only resolves DNS entries when the connections are created. It does not track any time to live (TTL) durations specified by the DNS server. If DNS entries are changing regularly, which can happen in some container scenarios, you can use the to limit the lifetime of the connection so that DNS lookup is required when replacing the connection.
-
-## Examples
-
- :::code language="csharp" source="~/snippets/csharp/System.Net.Http/HttpClient/source.cs" id="Snippet1":::
- :::code language="fsharp" source="~/snippets/fsharp/System.Net.Http/HttpClient/source.fs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Misc/system.net.http.httpclient/vb/source.vb" id="Snippet1":::
-
- The preceding code example uses an `async Task Main()` entry point. That feature requires C# 7.1 or later.
-
- ]]>
-
+
+
+
+ For more information about this API, see Supplemental API remarks for HttpClient.
Guidelines for using HttpClient
HttpClient Sample
@@ -213,30 +67,30 @@ HttpClient only resolves DNS entries when the connections are created. It does n
Initializes a new instance of the class.
- is intended to be instantiated once and re-used throughout the life of an application. Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. This will result in SocketException errors. Below is an example using HttpClient correctly.
-
-```csharp
-public class GoodController : ApiController
-{
- private static readonly HttpClient HttpClient;
-
- static GoodController()
- {
- HttpClient = new HttpClient();
- }
-}
+ is intended to be instantiated once and re-used throughout the life of an application. Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. This will result in SocketException errors. Below is an example using HttpClient correctly.
+
+```csharp
+public class GoodController : ApiController
+{
+ private static readonly HttpClient HttpClient;
+
+ static GoodController()
+ {
+ HttpClient = new HttpClient();
+ }
+}
```
```vb
Public Class GoodController
- Inherits ApiController
-
+ Inherits ApiController
+
Private Shared ReadOnly HttpClient As HttpClient
-
- Shared Sub New()
+
+ Shared Sub New()
HttpClient = New HttpClient()
End Sub
End Class
@@ -275,8 +129,8 @@ End Class
Initializes a new instance of the class using a that is disposed when this instance is disposed.
-
@@ -315,11 +169,11 @@ Using this constructor is equivalent to calling the [`HttpClient(new HttpClientH
The HTTP handler stack to use for sending requests.
Initializes a new instance of the class with the specified handler. The handler is disposed when this instance is disposed.
-
The is .
@@ -412,13 +266,13 @@ The specified `handler` will be disposed of by calling [HttpClient.Dispose](xref
Gets or sets the base address of Uniform Resource Identifier (URI) of the Internet resource used when sending requests.
The base address of Uniform Resource Identifier (URI) of the Internet resource used when sending requests.
- with a relative Uri, the message Uri will be added to the property to create an absolute Uri.
-
+ with a relative Uri, the message Uri will be added to the property to create an absolute Uri.
+
Note that all characters after the right-most "/" in the base URI are excluded when combined with the message URI. See [RFC 3986](https://tools.ietf.org/html/rfc3986) Uniform Resource Identifier (URI) Generic Syntax specification.
-
+
]]>
@@ -456,11 +310,11 @@ The specified `handler` will be disposed of by calling [HttpClient.Dispose](xref
Cancel all pending requests on this instance.
- instance can still be used to execute additional requests.
-
+ instance can still be used to execute additional requests.
+
]]>
@@ -492,8 +346,8 @@ The specified `handler` will be disposed of by calling [HttpClient.Dispose](xref
Gets or sets the global HTTP proxy.
A proxy used by every HTTP request.
- instances use if no proxy is set explicitly in the passed through its constructor.
@@ -551,11 +405,11 @@ The proxy server may be a hostname or IP address, optionally followed by a colon
Gets the headers which should be sent with each request.
The headers which should be sent with each request.
-
@@ -587,9 +441,9 @@ The proxy server may be a hostname or IP address, optionally followed by a colon
Gets or sets the default HTTP version used on subsequent requests made by this instance.
The default version to use for any requests made with this instance.
- by default.
The `DefaultRequestVersion` property specifies the default HTTP version to use for requests sent using this instance when it constructs the to send, specifically with calls to methods such as , , , , , , , and .
@@ -629,9 +483,9 @@ The `DefaultRequestVersion` property can be changed as long as the Gets or sets the default version policy for implicitly created requests in convenience methods, for example, and .
The HttpVersionPolicy used when the HTTP connection is established.
- or overloads that accept an .
]]>
@@ -698,10 +552,10 @@ This property has no effect on any of the Send a DELETE request to the specified Uri as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -768,10 +622,10 @@ The is not an absolute URI.
Send a DELETE request to the specified Uri as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -844,10 +698,10 @@ The is not an absolute URI.
Send a DELETE request to the specified Uri with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -917,10 +771,10 @@ The is not an absolute URI.
Send a DELETE request to the specified Uri with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -980,15 +834,15 @@ The is not an absolute URI.
to release both managed and unmanaged resources; to releases only unmanaged resources.
Releases the unmanaged resources used by the and optionally disposes of the managed resources.
- method, if it has been overridden. `Dispose()` invokes this method with the `disposing` parameter set to `true`. `Finalize` invokes this method with `disposing` set to `false`.
-
- When the `disposing` parameter is `true`, this method releases all resources held by any managed objects that this references. This method invokes the `Dispose()` method of each referenced object.
-
- When this method is called, the method is called to abort all pending requests.
-
+
+ When the `disposing` parameter is `true`, this method releases all resources held by any managed objects that this references. This method invokes the `Dispose()` method of each referenced object.
+
+ When this method is called, the method is called to abort all pending requests.
+
]]>
@@ -1003,11 +857,11 @@ The is not an absolute URI.
Send a GET request to the specified Uri as an asynchronous operation.
-
@@ -1061,9 +915,9 @@ The is not an absolute URI.
Send a GET request to the specified Uri as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read. The behavior is the same as if has been explicitly specified.
> [!NOTE]
@@ -1124,9 +978,9 @@ The is not an absolute URI.
Send a GET request to the specified Uri as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read. The behavior is the same as if has been explicitly specified.
> [!NOTE]
@@ -1192,10 +1046,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri with an HTTP completion option as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete based on the `completionOption` parameter after the part or all of the response (including content) is read.
+ object will complete based on the `completionOption` parameter after the part or all of the response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -1261,9 +1115,9 @@ The is not an absolute URI.
Send a GET request to the specified Uri with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read. The behavior is the same as if has been explicitly specified.
> [!NOTE]
@@ -1327,10 +1181,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri with an HTTP completion option as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete based on the `completionOption` parameter after the part or all of the response (including content) is read.
+ object will complete based on the `completionOption` parameter after the part or all of the response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -1391,9 +1245,9 @@ The is not an absolute URI.
Send a GET request to the specified Uri with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read. The behavior is the same as if has been explicitly specified.
> [!NOTE]
@@ -1462,10 +1316,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri with an HTTP completion option and a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete based on the `completionOption` parameter after the part or all of the response (including content) is read.
+ object will complete based on the `completionOption` parameter after the part or all of the response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -1530,10 +1384,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri with an HTTP completion option and a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete based on the `completionOption` parameter after the part or all of the response (including content) is read.
+ object will complete based on the `completionOption` parameter after the part or all of the response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -1558,11 +1412,11 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.
-
@@ -1622,10 +1476,10 @@ The is not an absolute URI.
Sends a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response body is read.
+ object will complete after the whole response body is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -1691,10 +1545,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response body is read.
+ object will complete after the whole response body is read.
> [!NOTE]
> In case of a timeout:
@@ -1751,10 +1605,10 @@ The is not an absolute URI.
Sends a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response body is read.
+ object will complete after the whole response body is read.
> [!NOTE]
> In case of a timeout:
@@ -1808,10 +1662,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response body is read.
+ object will complete after the whole response body is read.
> [!NOTE]
> In case of a timeout:
@@ -1836,11 +1690,11 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.
-
@@ -1900,10 +1754,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.
The task object representing the asynchronous operation.
- ](xref:System.Threading.Tasks.Task%601) object will complete after the response headers are read. This method does not read nor buffer the response body.
+ ](xref:System.Threading.Tasks.Task%601) object will complete after the response headers are read. This method does not read nor buffer the response body.
> [!NOTE]
> In case of a timeout:
@@ -1969,10 +1823,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.
The task object representing the asynchronous operation.
- ](xref:System.Threading.Tasks.Task%601) object will complete after the response headers are read. This method does not read nor buffer the response body.
+ ](xref:System.Threading.Tasks.Task%601) object will complete after the response headers are read. This method does not read nor buffer the response body.
> [!NOTE]
> In case of a timeout:
@@ -2029,9 +1883,9 @@ The is not an absolute URI.
The task object representing the asynchronous operation.
](xref:System.Threading.Tasks.Task%601) object will complete after the response headers are read. This method does not read nor buffer the response body.
+
+## Remarks
+ This operation will not block. The returned [Task\](xref:System.Threading.Tasks.Task%601) object will complete after the response headers are read. This method does not read nor buffer the response body.
> [!NOTE]
> In case of a timeout:
@@ -2085,10 +1939,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.
The task object representing the asynchronous operation.
- ](xref:System.Threading.Tasks.Task%601) object will complete after the response headers are read. This method does not read nor buffer the response body.
+ ](xref:System.Threading.Tasks.Task%601) object will complete after the response headers are read. This method does not read nor buffer the response body.
> [!NOTE]
> In case of a timeout:
@@ -2113,11 +1967,11 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.
-
@@ -2177,10 +2031,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response body is read.
+ object will complete after the whole response body is read.
> [!NOTE]
> In case of a timeout:
@@ -2246,10 +2100,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response body is read.
+ object will complete after the whole response body is read.
> [!NOTE]
> In case of a timeout:
@@ -2305,10 +2159,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response body is read.
+ object will complete after the whole response body is read.
> [!NOTE]
> In case of a timeout:
@@ -2362,10 +2216,10 @@ The is not an absolute URI.
Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response body is read.
+ object will complete after the whole response body is read.
> [!NOTE]
> In case of a timeout:
@@ -2413,11 +2267,11 @@ The is not an absolute URI.
Gets or sets the maximum number of bytes to buffer when reading the response content.
The maximum number of bytes to buffer when reading the response content. The default value for this property is 2 gigabytes.
- property to a lower value to limit the size of the response to buffer when reading the response. If the size of the response content is greater than the property, an exception is thrown.
-
+ property to a lower value to limit the size of the response to buffer when reading the response. If the size of the response content is greater than the property, an exception is thrown.
+
]]>
The size specified is less than or equal to zero.
@@ -2474,11 +2328,11 @@ The is not an absolute URI.
Sends a PATCH request to a Uri designated as a string as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
-
+ object will complete after the whole response (including content) is read.
+
]]>
The provided request URI is not valid relative or absolute URI.
@@ -2526,11 +2380,11 @@ The is not an absolute URI.
Sends a PATCH request as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
-
+ object will complete after the whole response (including content) is read.
+
]]>
@@ -2586,11 +2440,11 @@ The is not an absolute URI.
Sends a PATCH request with a cancellation token to a Uri represented as a string as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
-
+ object will complete after the whole response (including content) is read.
+
]]>
The provided request URI is not valid relative or absolute URI.
@@ -2641,11 +2495,11 @@ The is not an absolute URI.
Sends a PATCH request with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
-
+ object will complete after the whole response (including content) is read.
+
]]>
The cancellation token was canceled. This exception is stored into the returned task.
@@ -2661,11 +2515,11 @@ The is not an absolute URI.
Send a POST request to the specified Uri as an asynchronous operation.
-
@@ -2724,10 +2578,10 @@ The is not an absolute URI.
Send a POST request to the specified Uri as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -2789,10 +2643,10 @@ The is not an absolute URI.
Send a POST request to the specified Uri as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -2862,10 +2716,10 @@ The is not an absolute URI.
Send a POST request with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -2930,10 +2784,10 @@ The is not an absolute URI.
Send a POST request with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -2958,11 +2812,11 @@ The is not an absolute URI.
Send a PUT request to the specified Uri as an asynchronous operation.
-
@@ -3021,10 +2875,10 @@ The is not an absolute URI.
Send a PUT request to the specified Uri as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -3086,10 +2940,10 @@ The is not an absolute URI.
Send a PUT request to the specified Uri as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -3159,10 +3013,10 @@ The is not an absolute URI.
Send a PUT request with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -3227,10 +3081,10 @@ The is not an absolute URI.
Send a PUT request with a cancellation token as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete after the whole response (including content) is read.
+ object will complete after the whole response (including content) is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -3477,11 +3331,11 @@ The custom does not override
Send an HTTP request as an asynchronous operation.
-
@@ -3523,9 +3377,9 @@ The custom does not override
Send an HTTP request as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete once the entire response including content is read. The behavior is the same as if has been explicitly specified.
> [!NOTE]
@@ -3583,10 +3437,10 @@ This method stores in the task it returns all non-usage exceptions that the meth
Send an HTTP request as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete as soon as a response is available or the entire response including content is read.
+ object will complete as soon as a response is available or the entire response including content is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -3643,9 +3497,9 @@ This method stores in the task it returns all non-usage exceptions that the meth
Send an HTTP request as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete once the entire response including content is read. The behavior is the same as if has been explicitly specified.
> [!NOTE]
@@ -3706,10 +3560,10 @@ This method stores in the task it returns all non-usage exceptions that the meth
Send an HTTP request as an asynchronous operation.
The task object representing the asynchronous operation.
- object will complete as soon as a response is available or the entire response including content is read.
+ object will complete as soon as a response is available or the entire response including content is read.
> [!NOTE]
> In case of timeout, different exceptions are thrown on different .NET implementations.
@@ -3761,21 +3615,21 @@ This method stores in the task it returns all non-usage exceptions that the meth
Gets or sets the timespan to wait before the request times out.
The timespan to wait before the request times out.
- .
-
- A Domain Name System (DNS) query may take up to 15 seconds to return or time out. If your request contains a host name that requires resolution and you set to a value less than 15 seconds, it may take 15 seconds or more before a is thrown to indicate a timeout on your request.
-
- The same timeout will apply for all requests using this instance. You may also set different timeouts for individual requests using a on a task. Note that only the shorter of the two timeouts will apply.
-
+ .
+
+ A Domain Name System (DNS) query may take up to 15 seconds to return or time out. If your request contains a host name that requires resolution and you set to a value less than 15 seconds, it may take 15 seconds or more before a is thrown to indicate a timeout on your request.
+
+ The same timeout will apply for all requests using this instance. You may also set different timeouts for individual requests using a on a task. Note that only the shorter of the two timeouts will apply.
+
## Examples
-
+
The following example sets the `Timeout` property.
-
+
```csharp
HttpClient httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromMinutes(10);
diff --git a/xml/System.Net.Http/HttpClientHandler.xml b/xml/System.Net.Http/HttpClientHandler.xml
index 6616b1e3f7e..21630f12d0c 100644
--- a/xml/System.Net.Http/HttpClientHandler.xml
+++ b/xml/System.Net.Http/HttpClientHandler.xml
@@ -45,50 +45,12 @@
The default message handler used by in .NET Framework and .NET Core 2.0 and earlier.
-
+
class. Prior to .NET Core 2.1, the `HttpClientHandler` class used older HTTP protocol stacks ( on Windows and `CurlHandler`, an internal class implemented on top of Linux's native `libcurl` component, on Linux).
-
-On .NET Core 2.1 - 3.1 only, you can configure your app to use the older HTTP protocol stacks in one of the following three ways:
-
-- Call the method:
-
- ```csharp
- AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
- ```
-
- ```vb
- AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", False)
- ```
-
-- Define the `System.Net.Http.UseSocketsHttpHandler` switch in the *.netcore.runtimeconfig.json* configuration file:
-
- ```json
- "runtimeOptions": {
- "configProperties": {
- "System.Net.Http.UseSocketsHttpHandler": false
- }
- }
- ```
-
-- Define an environment variable named `DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER` and set it to either `false` or **0**.
-
-These configuration options are not available starting with .NET 5.
-
-## Examples
- :::code language="csharp" source="~/snippets/csharp/System.Net.Http/HttpClientHandler/Overview/source.cs" id="Snippet1":::
-
- The preceding code example uses an `async Task Main()` entry point. That feature requires C# 7.1 or later.
-
- ]]>
-
+ :::code language="csharp" source="~/snippets/csharp/System.Net.Http/HttpClientHandler/Overview/source.cs" id="Snippet1":::
+ ]]>
+
+ For more information about this API, see Supplemental API remarks for HttpClientHandler.
Connecting to a web service
Quickstart: Connecting using HttpClient
How to use HttpClient handlers
@@ -371,9 +333,9 @@ After NuGet package v4.3.2, the default value of Gets the collection of security certificates that are associated with requests to the server.
The X509CertificateCollection that is presented to the server when performing certificate based client authentication.
- Gets or sets the maximum number of concurrent connections (per server endpoint) allowed when making requests using an object. Note that the limit is per server endpoint, so for example a value of 256 would permit 256 concurrent connections to http://www.adatum.com/ and another 256 to http://www.adventure-works.com/.
The maximum number of concurrent connections (per server endpoint) allowed by an object.
-
@@ -1202,7 +1164,7 @@ handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousA
Gets or sets a callback method to validate the server certificate.
A callback method to validate the server certificate.
- can be used to obtain and validate the server certificate.
@@ -1456,7 +1418,7 @@ handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousA
## Remarks
Set this property to `true` when requests made by the object should, if requested by the server, be authenticated using the credentials of the currently logged on user. For client applications, this is the desired behavior in most scenarios. For middle-tier applications, such as ASP.NET applications, instead of using this property, you would typically set the property to the credentials of the client on whose behalf the request is made.
-
+
This property doesn't affect proxy credentials. When the default (system) proxy is being used, set credentials explicitly by using the property. When the proxy is set by the property, set credentials for the proxy via its property.
If this property has been set to `true` then, it has a side effect on property, and will be set to .
diff --git a/xml/System.Net.Sockets/Socket.xml b/xml/System.Net.Sockets/Socket.xml
index 877339ea3a4..e5c70078ec8 100644
--- a/xml/System.Net.Sockets/Socket.xml
+++ b/xml/System.Net.Sockets/Socket.xml
@@ -60,51 +60,22 @@
Implements the Berkeley sockets interface.
-
+ For more information about this API, see Supplemental API remarks for Socket.
+
class can be used to send data to an HTTP server, printing the ASCII response to the standard output. This example blocks the calling thread until the entire page is received.
-## Remarks
- The class provides a rich set of methods and properties for network communications. The class allows you to perform both synchronous and asynchronous data transfer using any of the communication protocols listed in the enumeration.
-
- The class follows the .NET Framework naming pattern for asynchronous methods. For example, the synchronous method corresponds to the asynchronous variants.
-
- Use the following methods for synchronous operation mode.
-
-- If you are using a connection-oriented protocol such as TCP, your server can listen for connections using the method. The method processes any incoming connection requests and returns a that you can use to communicate data with the remote host. Use this returned to call the or method. Call the method prior to calling the method if you want to specify the local IP address and port number. Use a port number of zero if you want the underlying service provider to assign a free port for you. If you want to connect to a listening host, call the method. To communicate data, call the or method.
-
-- If you are using a connectionless protocol such as UDP, you do not need to listen for connections at all. Call the method to accept any incoming datagrams. Use the method to send datagrams to a remote host.
-
- To process communications asynchronously, use the following methods.
-
-- If you are using a connection-oriented protocol such as TCP, use to connect with a listening host. Use or to communicate data asynchronously. Incoming connection requests can be processed using .
-
-- If you are using a connectionless protocol such as UDP, you can use to send datagrams, and to receive datagrams.
-
- If you perform multiple asynchronous operations on a socket, they do not necessarily complete in the order in which they are started.
+ :::code language="csharp" source="~/snippets/csharp/System.Net.Sockets/Socket/Overview/socket.cs" id="Snippet1":::
- When you are finished sending and receiving data, use the method to disable the . After calling , call the method to release all resources associated with the .
+ The next example demonstrates the same HTTP GET scenario, using Task-based asynchronous APIs, while also forwarding a to the asynchronous methods, making the entire operation cancellable.
- The class allows you to configure your using the method. Retrieve these settings using the method.
+ > [!TIP]
+ > 's async methods that do not take a typically return a , which is allocated on the heap.
+ > Cancellable overloads are always -returning; using them helps reducing allocations in high-performance code.
-## Examples
-
-### Synchronous mode
- The following example shows how the class can be used to send data to an HTTP server, printing the ASCII response to the standard output.
- This example blocks the calling thread until the entire page is received.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net.Sockets/Socket/Overview/socket.cs" id="Snippet1":::
-
-### Asynchronous mode
- The second example demonstrates the same HTTP GET scenario, using Task-based asynchronous API-s, while also forwarding a to the asynchronous methods, making the entire operation cancellable.
-
- > [!TIP]
- > 's async methods that do not take a typically return a , which is allocated on the heap.
- > Cancellable overloads are always -returning; using them helps reducing allocations in high-performance code.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net.Sockets/Socket/Overview/socket.cs" id="Snippet2":::
-
- ]]>
-
+ :::code language="csharp" source="~/snippets/csharp/System.Net.Sockets/Socket/Overview/socket.cs" id="Snippet2":::
+ ]]>
+
It is safe to perform a send and a receive operation simultaneously on a instance,
but it's not recommended to issue multiple send or multiple receive calls concurrently. Depending on the underlying platform
diff --git a/xml/System.Net/HttpListener.xml b/xml/System.Net/HttpListener.xml
index 825c5204e13..a00e0fdef63 100644
--- a/xml/System.Net/HttpListener.xml
+++ b/xml/System.Net/HttpListener.xml
@@ -52,57 +52,13 @@
Provides a simple, programmatically controlled HTTP protocol listener. This class cannot be inherited.
-
- class, you can create a simple HTTP protocol listener that responds to HTTP requests. The listener is active for the lifetime of the object and runs within your application with its permissions.
-
- To use , create a new instance of the class using the constructor and use the property to gain access to the collection that holds the strings that specify which Uniform Resource Identifier (URI) prefixes the should process.
-
- A URI prefix string is composed of a scheme (http or https), a host, an optional port, and an optional path. An example of a complete prefix string is *http://www.contoso.com:8080/customerData/*. Prefixes must end in a forward slash ("/"). The object with the prefix that most closely matches a requested URI responds to the request. Multiple objects cannot add the same prefix; a exception is thrown if a adds a prefix that is already in use.
-
- When a port is specified, the host element can be replaced with "\*" to indicate that the accepts requests sent to the port if the requested URI does not match any other prefix. For example, to receive all requests sent to port 8080 when the requested URI is not handled by any , the prefix is *http://\*:8080/*. Similarly, to specify that the accepts all requests sent to a port, replace the host element with the "+" character. For example, *https://+:8080*. The "\*" and "+" characters can be present in prefixes that include paths.
-
- Starting with .NET Core 2.0 or .NET Framework 4.6 on Windows 10, wildcard subdomains are supported in URI prefixes that are managed by an object. To specify a wildcard subdomain, use the "\*" character as part of the hostname in a URI prefix. For example, *http://\*.foo.com/*. Pass this as the argument to the method. This works as of .NET Core 2.0 or .NET Framework 4.6 on Windows 10; in earlier versions, this generates an .
-
- > [!WARNING]
- > Top-level wildcard bindings (*http://\*:8080/* and *http://+:8080*) should **not** be used. Top-level wildcard bindings can open up your app to security vulnerabilities. This applies to both strong and weak wildcards. Use explicit host names rather than wildcards. Subdomain wildcard binding (for example, `*.mysub.com`) doesn't have this security risk if you control the entire parent domain (as opposed to `*.com`, which is vulnerable). See [rfc7230 section-5.4](https://tools.ietf.org/html/rfc7230#section-5.4) for more information.
-
- To begin listening for requests from clients, add the URI prefixes to the collection and call the method. offers both synchronous and asynchronous models for processing client requests. Requests and their associated responses are accessed using the object returned by the method or its asynchronous counterparts, the and methods.
-
- The synchronous model is appropriate if your application should block while waiting for a client request and if you want to process only one request at a time. Using the synchronous model, call the method, which waits for a client to send a request. The method returns an object to you for processing when one occurs.
-
- In the more complex asynchronous model, your application does not block while waiting for requests and each request is processed in its own execution thread. Use the method to specify an application-defined method to be called for each incoming request. Within that method, call the method to obtain the request, process it, and respond.
-
- In either model, incoming requests are accessed using the property and are represented by objects. Similarly, responses are accessed using the property and are represented by objects. These objects share some functionality with the and objects, but the latter objects cannot be used in conjunction with because they implement client, not server, behaviors.
-
- An can require client authentication. You can either specify a particular scheme to use for authentication, or you can specify a delegate that determines the scheme to use. You must require some form of authentication to obtain information about the client's identity. For additional information, see the , , and properties.
-
-> [!NOTE]
-> If you create an using https, you must select a Server Certificate for that listener. Otherwise, requests to this will fail with an unexpected close of the connection.
-
-> [!NOTE]
-> You can configure Server Certificates and other listener options by using Network Shell (netsh.exe). See [Network Shell (Netsh)](/windows-server/networking/technologies/netsh/netsh) for more details. The executable began shipping with Windows Server 2008 and Windows Vista.
-
-> [!NOTE]
-> If you specify multiple authentication schemes for the , the listener will challenge clients in the following order: `Negotiate`, `NTLM`, `Digest`, and then `Basic`.
-
-### HTTP.sys
-
-The class is built on top of `HTTP.sys`, which is the kernel mode listener that handles all HTTP traffic for Windows.
-`HTTP.sys` provides connection management, bandwidth throttling, and web server logging.
-Use the [HttpCfg.exe](/windows/win32/http/httpcfg-exe) tool to add SSL certificates.
-
-## Examples
- The following code example demonstrates using a .
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet2":::
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for HttpListener.
+
+
+
Changes to NTLM authentication for HTTPWebRequest in Version 3.5 SP1
HttpCfg.exe
@@ -139,19 +95,19 @@ Use the [HttpCfg.exe](/windows/win32/http/httpcfg-exe) tool to add SSL certifica
Initializes a new instance of the class.
- method.
-
-
-
-## Examples
- The following code example demonstrates using the constructor to create a new object. For the complete example, see the class topic.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet9":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet9":::
-
+ method.
+
+
+
+## Examples
+ The following code example demonstrates using the constructor to create a new object. For the complete example, see the class topic.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet9":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet9":::
+
]]>
This class cannot be used on the current operating system. Windows Server 2003 or Windows XP SP2 is required to use instances of this class.
@@ -196,21 +152,21 @@ Use the [HttpCfg.exe](/windows/win32/http/httpcfg-exe) tool to add SSL certifica
Shuts down the object immediately, discarding all currently queued requests.
- if you attempt to use this .
-
-
-
-## Examples
- The following code example demonstrates calling this method.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet11":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet11":::
-
+ if you attempt to use this .
+
+
+
+## Examples
+ The following code example demonstrates calling this method.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet11":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet11":::
+
]]>
@@ -260,26 +216,26 @@ Use the [HttpCfg.exe](/windows/win32/http/httpcfg-exe) tool to add SSL certifica
Gets or sets the scheme used to authenticate clients.
A bitwise combination of enumeration values that indicates how clients are to be authenticated. The default value is .
- uses the specified scheme to authenticate all incoming requests. The and methods return an incoming client request only if the successfully authenticates the request.
-
- You can interrogate the identity of a successfully authenticated client by using the property.
-
- If you want an object to use different authentication mechanisms based on characteristics of the requests it receives (for example, the request's or property), you must implement a method that chooses the authentication scheme. For instructions about how to do this, see the property documentation.
-
+ uses the specified scheme to authenticate all incoming requests. The and methods return an incoming client request only if the successfully authenticates the request.
+
+ You can interrogate the identity of a successfully authenticated client by using the property.
+
+ If you want an object to use different authentication mechanisms based on characteristics of the requests it receives (for example, the request's or property), you must implement a method that chooses the authentication scheme. For instructions about how to do this, see the property documentation.
+
> [!NOTE]
-> To set this property to enable Digest, NTLM, or Negotiate requires the , .
-
-
-
-## Examples
- The following code example demonstrates using the property to specify an authentication scheme.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet14":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet14":::
-
+> To set this property to enable Digest, NTLM, or Negotiate requires the , .
+
+
+
+## Examples
+ The following code example demonstrates using the property to specify an authentication scheme.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet14":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet14":::
+
]]>
This object has been closed.
@@ -336,33 +292,33 @@ Use the [HttpCfg.exe](/windows/win32/http/httpcfg-exe) tool to add SSL certifica
Gets or sets the delegate called to determine the protocol used to authenticate clients.
An delegate that invokes the method used to select an authentication protocol. The default value is .
- [!NOTE]
-> If you want the same authentication protocol to be used for all requests handled by a particular instance of , you do not need to set this property. To specify a protocol to be used for all client requests, use the property.
-
- If the client has not specified authentication information in its headers, the calls the specified delegate for each unauthenticated incoming request to determine which, if any, protocol to use to authenticate the client. The and methods return an incoming request only if the successfully authenticated the request. If a request cannot be authenticated, the automatically sends back a 401 response. You can get the identity of a successfully authenticated client using the property.
-
- The ability to delegate the choice of authentication protocol to an application-specific method is useful if you want an instance of to use different authentication protocols depending on the characteristics of the requests it receives (for example, the request's or property).
-
+> If you want the same authentication protocol to be used for all requests handled by a particular instance of , you do not need to set this property. To specify a protocol to be used for all client requests, use the property.
+
+ If the client has not specified authentication information in its headers, the calls the specified delegate for each unauthenticated incoming request to determine which, if any, protocol to use to authenticate the client. The and methods return an incoming request only if the successfully authenticated the request. If a request cannot be authenticated, the automatically sends back a 401 response. You can get the identity of a successfully authenticated client using the property.
+
+ The ability to delegate the choice of authentication protocol to an application-specific method is useful if you want an instance of to use different authentication protocols depending on the characteristics of the requests it receives (for example, the request's or property).
+
> [!NOTE]
-> To set this property to enable Digest, NTLM, or Negotiate requires the , .
-
-
-
-## Examples
- The following code example sets the value of this property.
-
+> To set this property to enable Digest, NTLM, or Negotiate requires the , .
+
+
+
+## Examples
+ The following code example sets the value of this property.
+
:::code language="csharp" source="~/snippets/csharp/System.Net/AuthenticationSchemes/Overview/sample.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLListener/vb/sample.vb" id="Snippet2":::
-
- The following code example provides an implementation of a method invoked by an delegate.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLListener/vb/sample.vb" id="Snippet2":::
+
+ The following code example provides an implementation of a method invoked by an delegate.
+
:::code language="csharp" source="~/snippets/csharp/System.Net/AuthenticationSchemes/Overview/sample.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLListener/vb/sample.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NCLListener/vb/sample.vb" id="Snippet1":::
+
]]>
This object has been closed.
@@ -417,30 +373,30 @@ Use the [HttpCfg.exe](/windows/win32/http/httpcfg-exe) tool to add SSL certifica
Begins asynchronously retrieving an incoming request.
An object that indicates the status of the asynchronous operation.
- method begins an asynchronous (non-blocking) call to receive incoming client requests. Before calling this method, you must call the method and add at least one Uniform Resource Identifier (URI) prefix to listen for by adding the URI strings to the returned by the property.
-
- The asynchronous operation must be completed by calling the method. Typically, the method is invoked by the `callback` delegate.
-
- This method does not block while the operation completes. To get an incoming request and block until the operation completes, call the method.
-
- For detailed information about using the asynchronous programming model, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously)
-
-
-
-## Examples
- The following code example demonstrates using the method to specify a callback method that will handle incoming client requests.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet12":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet12":::
-
- The following code example implements a callback method.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet13":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet13":::
-
+ method begins an asynchronous (non-blocking) call to receive incoming client requests. Before calling this method, you must call the method and add at least one Uniform Resource Identifier (URI) prefix to listen for by adding the URI strings to the returned by the property.
+
+ The asynchronous operation must be completed by calling the method. Typically, the method is invoked by the `callback` delegate.
+
+ This method does not block while the operation completes. To get an incoming request and block until the operation completes, call the method.
+
+ For detailed information about using the asynchronous programming model, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously)
+
+
+
+## Examples
+ The following code example demonstrates using the method to specify a callback method that will handle incoming client requests.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet12":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet12":::
+
+ The following code example implements a callback method.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet13":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet13":::
+
]]>
A Win32 function call failed. Check the exception's property to determine the cause of the exception.
@@ -487,20 +443,20 @@ Use the [HttpCfg.exe](/windows/win32/http/httpcfg-exe) tool to add SSL certifica
Shuts down the .
- object. To temporarily pause an object, use the method.
-
- This method shut downs the object without processing queued requests. Any pending requests are unable to complete.
-
-## Examples
+ object. To temporarily pause an object, use the method.
+
+ This method shut downs the object without processing queued requests. Any pending requests are unable to complete.
+
+## Examples
The following code example demonstrates calling the `Close` method:
-
-:::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet12":::
-:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet12":::
-
+
+:::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet12":::
+:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet12":::
+
]]>
@@ -544,37 +500,37 @@ The following code example demonstrates calling the `Close` method:
Gets a default list of Service Provider Names (SPNs) as determined by registered prefixes.
A that contains a list of SPNs.
- property is used with integrated Windows authentication to provide extended protection. The list of SPNs is initialized from the property when accessed and cleared when new prefixes are added to the property.
-
- The property is used if an application doesn't set the property on its extended protection policy.
-
- The that is retrieved with the property is built from the property according to the following rules:
-
-1. If the hostname is "+", "*", or an IPv4 or IPv6 literal (equivalent to "\*" but restricted to a specific local interface), the following SPN is added:
-
- `"HTTP/"` plus the fully qualified domain name of the computer.
-
-1. If the hostname contains no dots (no domains or subdomains), an attempt is made to resolve the fully-qualified domain name using DNS (the same behavior used by ). If the fully-qualified domain name can be resolved, the following SPNs are added:
-
- `"HTTP/"` plus the hostname (the short name).
-
- `"HTTP/"` plus the fully qualified domain name for the hostname.
-
-1. If the hostname contains not dots (no domains or subdomains) and a fully-qualified domain name can't be resolved, the following SPN is added:
-
- `"HTTP/"` plus the hostname.
-
-1. If the hostname contains dots (domains or subdomains), the following SPN is added:
-
- `"HTTP/"` plus the hostname.
-
- The property can be used by an application to review the list of default SPNs which will be used for authentication if no custom list is supplied. If other SPNs are needed, an application can add them using one of the methods.
-
- It is not safe when using extended protection to make policy decisions based on the requested URL, since this can be spoofed. Rather, applications should rely on the or properties to make such policy decisions.
-
+ property is used with integrated Windows authentication to provide extended protection. The list of SPNs is initialized from the property when accessed and cleared when new prefixes are added to the property.
+
+ The property is used if an application doesn't set the property on its extended protection policy.
+
+ The that is retrieved with the property is built from the property according to the following rules:
+
+1. If the hostname is "+", "*", or an IPv4 or IPv6 literal (equivalent to "\*" but restricted to a specific local interface), the following SPN is added:
+
+ `"HTTP/"` plus the fully qualified domain name of the computer.
+
+1. If the hostname contains no dots (no domains or subdomains), an attempt is made to resolve the fully-qualified domain name using DNS (the same behavior used by ). If the fully-qualified domain name can be resolved, the following SPNs are added:
+
+ `"HTTP/"` plus the hostname (the short name).
+
+ `"HTTP/"` plus the fully qualified domain name for the hostname.
+
+1. If the hostname contains not dots (no domains or subdomains) and a fully-qualified domain name can't be resolved, the following SPN is added:
+
+ `"HTTP/"` plus the hostname.
+
+1. If the hostname contains dots (domains or subdomains), the following SPN is added:
+
+ `"HTTP/"` plus the hostname.
+
+ The property can be used by an application to review the list of default SPNs which will be used for authentication if no custom list is supplied. If other SPNs are needed, an application can add them using one of the methods.
+
+ It is not safe when using extended protection to make policy decisions based on the requested URL, since this can be spoofed. Rather, applications should rely on the or properties to make such policy decisions.
+
]]>
@@ -625,23 +581,23 @@ The following code example demonstrates calling the `Close` method:
Completes an asynchronous operation to retrieve an incoming client request.
An object that represents the client request.
- method is called, usually within an application-defined callback method invoked by a delegate, to obtain the object that contains an incoming client request and its associated response. This method completes an operation previously started by calling the method. If the operation has not completed, this method blocks until it does.
-
- Because calling the method requires the object, this object is typically passed into a callback method by using the state object passed into the method. You can obtain this state object by using the property of the `asyncResult` object.
-
- For detailed information about using the asynchronous programming model, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously)
-
-
-
-## Examples
- The following code example shows the implementation of a callback method that calls the method.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet13":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet13":::
-
+ method is called, usually within an application-defined callback method invoked by a delegate, to obtain the object that contains an incoming client request and its associated response. This method completes an operation previously started by calling the method. If the operation has not completed, this method blocks until it does.
+
+ Because calling the method requires the object, this object is typically passed into a callback method by using the state object passed into the method. You can obtain this state object by using the property of the `asyncResult` object.
+
+ For detailed information about using the asynchronous programming model, see [Calling Synchronous Methods Asynchronously](/dotnet/standard/asynchronous-programming-patterns/calling-synchronous-methods-asynchronously)
+
+
+
+## Examples
+ The following code example shows the implementation of a callback method that calls the method.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet13":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet13":::
+
]]>
@@ -702,13 +658,13 @@ The following code example demonstrates calling the `Close` method:
Gets or sets the to use for extended protection for a session.
A that specifies the policy to use for extended protection.
- property is used with integrated Windows authentication to provide extended protection. The property allows the configuration of the extended protection policy for the whole session. The property allows the configuration of the extended protection policy for each individual request.
-
- The property must be `null`. The instance gets the Channel Binding Token (CBT) directly from its own TLS session if there is one.
-
+ property is used with integrated Windows authentication to provide extended protection. The property allows the configuration of the extended protection policy for the whole session. The property allows the configuration of the extended protection policy for each individual request.
+
+ The property must be `null`. The instance gets the Channel Binding Token (CBT) directly from its own TLS session if there is one.
+
]]>
An attempt was made to set the property, but the property was not .
@@ -779,17 +735,17 @@ The following code example demonstrates calling the `Close` method:
Gets or sets the delegate called to determine the to use for each request.
A that specifies the policy to use for extended protection.
- property is used with integrated Windows authentication to provide extended protection. The property allows the configuration of the extended protection policy for the whole session. The property allows the configuration of the extended protection policy per individual request.
-
- The property must be `null`. The instance gets the Channel Binding Token (CBT) directly from its own TLS session if there is one.
-
- For each request, the delegate can choose the settings that the instance will use to provide extended protection.
-
- If a delegate returns `null` for this property, this represents a which the property set to .
-
+ property is used with integrated Windows authentication to provide extended protection. The property allows the configuration of the extended protection policy for the whole session. The property allows the configuration of the extended protection policy per individual request.
+
+ The property must be `null`. The instance gets the Channel Binding Token (CBT) directly from its own TLS session if there is one.
+
+ For each request, the delegate can choose the settings that the instance will use to provide extended protection.
+
+ If a delegate returns `null` for this property, this represents a which the property set to .
+
]]>
An attempt was made to set the property, but the property must be .
@@ -842,28 +798,28 @@ The following code example demonstrates calling the `Close` method:
Waits for an incoming request and returns when one is received.
An object that represents a client request.
- method and add at least one URI prefix to listen for by adding the URI strings to the returned by the property. For a detailed description of prefixes, see the class overview.
-
- This method blocks while waiting for an incoming request. If you want incoming requests to be processed asynchronously (on separate threads) so that your application does not block, use the method.
-
-
-
-## Examples
- The following code example demonstrates calling this method.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet2":::
-
+ method and add at least one URI prefix to listen for by adding the URI strings to the returned by the property. For a detailed description of prefixes, see the class overview.
+
+ This method blocks while waiting for an incoming request. If you want incoming requests to be processed asynchronously (on separate threads) so that your application does not block, use the method.
+
+
+
+## Examples
+ The following code example demonstrates calling this method.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet2":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet2":::
+
]]>
A Win32 function call failed. Check the exception's property to determine the cause of the exception.
- This object has not been started or is currently stopped.
-
- -or-
-
+ This object has not been started or is currently stopped.
+
+ -or-
+
The does not have any Uniform Resource Identifier (URI) prefixes to respond to.
This object is closed.
@@ -907,13 +863,13 @@ The following code example demonstrates calling the `Close` method:
Waits for an incoming request as an asynchronous operation.
The task object representing the asynchronous operation. The property on the task object returns an object that represents a client request.
- object will complete when the incoming request has been received.
-
- Before calling this method, you must call the method and add at least one URI prefix to listen for by adding the URI strings to the returned by the property. For a detailed description of prefixes, see the class overview.
-
+ object will complete when the incoming request has been received.
+
+ Before calling this method, you must call the method and add at least one URI prefix to listen for by adding the URI strings to the returned by the property. For a detailed description of prefixes, see the class overview.
+
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
]]>
@@ -964,19 +920,19 @@ The following code example demonstrates calling the `Close` method:
if this should not return exceptions that occur when sending the response to the client; otherwise, . The default value is .
-
This object has been closed.
@@ -1019,19 +975,19 @@ The following code example demonstrates calling the `Close` method:
if the was started; otherwise, .
- , call the method.
-
-
-
-## Examples
- The following code example demonstrates using this property to determine the listening state of an instance.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet1":::
-
+ , call the method.
+
+
+
+## Examples
+ The following code example demonstrates using this property to determine the listening state of an instance.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet1":::
+
]]>
@@ -1073,14 +1029,14 @@ The following code example demonstrates calling the `Close` method:
on all platforms.
- property to detect whether an object can be used with the current operating system.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet2":::
-
+ property to detect whether an object can be used with the current operating system.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet2":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet2":::
+
]]>
@@ -1121,19 +1077,19 @@ The following code example demonstrates calling the `Close` method:
Gets the Uniform Resource Identifier (URI) prefixes handled by this object.
An that contains the URI prefixes that this object is configured to handle.
- class overview.
-
-
-
-## Examples
- The following code example demonstrates using the property to obtain and print the URI prefixes that are handled.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet1":::
-
+ class overview.
+
+
+
+## Examples
+ The following code example demonstrates using the property to obtain and print the URI prefixes that are handled.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet1":::
+
]]>
This object has been closed.
@@ -1194,21 +1150,21 @@ The following code example demonstrates calling the `Close` method:
Gets or sets the realm, or resource partition, associated with this object.
A value that contains the name of the realm associated with the object.
- has only one associated realm.
-
-
-
-## Examples
- The following code example demonstrates setting the property.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet10":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet10":::
-
+ has only one associated realm.
+
+
+
+## Examples
+ The following code example demonstrates setting the property.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet10":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet10":::
+
]]>
This object has been closed.
@@ -1250,24 +1206,24 @@ The following code example demonstrates calling the `Close` method:
Allows this instance to receive incoming requests.
- or method.
-
- After you have started an object, you can use the method to stop it.
-
+ or method.
+
+ After you have started an object, you can use the method to stop it.
+
> [!NOTE]
> If this listener instance uses https, you must install and select a Server Certificate. Otherwise, an query of this will fail with an unexpected close of the connection. You can configure Server Certificates and other listener options by using [HttpCfg.exe](/windows/win32/http/httpcfg-exe).
-
-
-
-## Examples
- The following code example demonstrates using the method to begin processing incoming requests.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet12":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet12":::
-
+
+
+
+## Examples
+ The following code example demonstrates using the method to begin processing incoming requests.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet12":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet12":::
+
]]>
A Win32 function call failed. Check the exception's property to determine the cause of the exception.
@@ -1313,22 +1269,22 @@ The following code example demonstrates calling the `Close` method:
Causes this instance to stop receiving new incoming requests and terminates processing of all ongoing requests.
- object, you can use the method to restart it.
+ object, you can use the method to restart it.
This method does not block to finish sending responses for currently accepted connections.
-
-## Examples
-
-The following code example demonstrates using the method to stop processing incoming requests.
-
-:::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet2":::
-:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet2":::
-
+
+## Examples
+
+The following code example demonstrates using the method to stop processing incoming requests.
+
+:::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet2":::
+:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet2":::
+
]]>
This object has been closed.
@@ -1382,11 +1338,11 @@ The following code example demonstrates using the
Releases the resources held by this object.
- method instead of calling this method.
-
+ method instead of calling this method.
+
]]>
@@ -1426,11 +1382,11 @@ The following code example demonstrates using the The timeout manager for this instance.
The timeout manager for this instance.
- instance.
-
+ instance.
+
]]>
@@ -1478,24 +1434,24 @@ The following code example demonstrates using the
if the of the first request will be used for subsequent requests on the same connection; otherwise, . The default value is .
- ) of the initial request.
-
- This property has no effect when NTLM is not the authentication protocol. When Negotiate is specified as the authentication protocol, this property has an effect only if NTLM is the actual protocol used for authentication.
-
+ ) of the initial request.
+
+ This property has no effect when NTLM is not the authentication protocol. When Negotiate is specified as the authentication protocol, this property has an effect only if NTLM is the actual protocol used for authentication.
+
> [!NOTE]
-> While setting this property to `true` increases performance because the does not send additional NTLM authentication challenges, there is a security risk in not requiring all requests to provide authentication information. You must determine whether the increase in performance is worth this risk.
-
-
-
-## Examples
- The following code example demonstrates setting this property.
-
- :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet14":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet14":::
-
+> While setting this property to `true` increases performance because the does not send additional NTLM authentication challenges, there is a security risk in not requiring all requests to provide authentication information. You must determine whether the increase in performance is worth this risk.
+
+
+
+## Examples
+ The following code example demonstrates setting this property.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Net/HttpListener/Overview/test.cs" id="Snippet14":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/Net_Listener_Basic/VB/test.vb" id="Snippet14":::
+
]]>
This object has been closed.
diff --git a/xml/System.Numerics/BigInteger.xml b/xml/System.Numerics/BigInteger.xml
index e1671967e7c..3beb8f4f0a9 100644
--- a/xml/System.Numerics/BigInteger.xml
+++ b/xml/System.Numerics/BigInteger.xml
@@ -226,124 +226,7 @@
Represents an arbitrarily large signed integer.
-
- type is an immutable type that represents an arbitrarily large integer whose value in theory has no upper or lower bounds. The members of the type closely parallel those of other integral types (the , , , , , , , and types). This type differs from the other integral types in the .NET Framework, which have a range indicated by their `MinValue` and `MaxValue` properties.
-
-> [!NOTE]
-> Because the type is immutable (see [Mutability and the BigInteger Structure](#mutability)) and because it has no upper or lower bounds, an can be thrown for any operation that causes a value to grow too large.
-
-## Instantiating a BigInteger Object
- You can instantiate a object in several ways:
-
-- You can use the `new` keyword and provide any integral or floating-point value as a parameter to the constructor. (Floating-point values are truncated before they are assigned to the .) The following example illustrates how to use the `new` keyword to instantiate values.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/BigInteger_Examples.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet1":::
-
-- You can declare a variable and assign it a value just as you would any numeric type, as long as that value is an integral type. The following example uses assignment to create a value from an .
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/BigInteger_Examples.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet2":::
-
-- You can assign a decimal or floating-point value to a object if you cast the value or convert it first. The following example explicitly casts (in C#) or converts (in Visual Basic) a and a value to a .
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/BigInteger_Examples.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet3":::
-
- These methods enable you to instantiate a object whose value is in the range of one of the existing numeric types only. You can instantiate a object whose value can exceed the range of the existing numeric types in one of three ways:
-
-- You can use the `new` keyword and provide a byte array of any size to the constructor. For example:
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/BigInteger_Examples.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet4":::
-
-- You can call the or methods to convert the string representation of a number to a . For example:
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/BigInteger_Examples.cs" id="Snippet5":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet5":::
-
-- You can call a `static` (`Shared` in Visual Basic) method that performs some operation on a numeric expression and returns a calculated result. The following example does this by cubing and assigning the result to a .
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/BigInteger_Examples.cs" id="Snippet6":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet6":::
-
- The uninitialized value of a is .
-
-## Performing Operations on BigInteger Values
- You can use a instance as you would use any other integral type. overloads the standard numeric operators to enable you to perform basic mathematical operations such as addition, subtraction, division, multiplication, and unary negation. You can also use the standard numeric operators to compare two values with each other. Like the other integral types, also supports the bitwise `And`, `Or`, `XOr`, left shift, and right shift operators. For languages that do not support custom operators, the structure also provides equivalent methods for performing mathematical operations. These include , , , , , and several others.
-
- Many members of the structure correspond directly to members of the other integral types. In addition, adds members such as the following:
-
-- , which returns a value that indicates the sign of a value.
-
-- , which returns the absolute value of a value.
-
-- , which returns both the quotient and remainder of a division operation.
-
-- , which returns the greatest common divisor of two values.
-
- Many of these additional members correspond to the members of the class, which provides the functionality to work with the primitive numeric types.
-
-
-## Mutability and the BigInteger Structure
- The following example instantiates a object and then increments its value by one.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/Mutability_Examples.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.Mutability/vb/Mutability_Examples.vb" id="Snippet1":::
-
- Although this example appears to modify the value of the existing object, this is not the case. objects are immutable, which means that internally, the common language runtime actually creates a new object and assigns it a value one greater than its previous value. This new object is then returned to the caller.
-
-> [!NOTE]
-> The other numeric types in .NET are also immutable. However, because the type has no upper or lower bounds, its values can grow extremely large and have a measurable impact on performance.
-
- Although this process is transparent to the caller, it does incur a performance penalty. In some cases, especially when repeated operations are performed in a loop on very large values, that performance penalty can be significant. For example, in the following example, an operation is performed repetitively up to a million times, and a value is incremented by one every time the operation succeeds.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/Mutability_Examples.cs" id="Snippet12":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.Mutability/vb/Mutability_Examples.vb" id="Snippet12":::
-
- In such a case, you can improve performance by performing all intermediate assignments to an variable. The final value of the variable can then be assigned to the object when the loop exits. The following example provides an illustration.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/Mutability_Examples.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.Mutability/vb/Mutability_Examples.vb" id="Snippet3":::
-
-## Working with Byte Arrays and Hexadecimal Strings
- If you convert values to byte arrays, or if you convert byte arrays to values, you must consider the order of bytes. The structure expects the individual bytes in a byte array to appear in little-endian order (that is, the lower-order bytes of the value precede the higher-order bytes). You can round-trip a value by calling the method and then passing the resulting byte array to the constructor, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/ByteAndHex_Examples.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.ByteAndHex/vb/ByteAndHex_Examples.vb" id="Snippet1":::
-
- To instantiate a value from a byte array that represents a value of some other integral type, you can pass the integral value to the method, and then pass the resulting byte array to the constructor. The following example instantiates a value from a byte array that represents an value.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/ByteAndHex_Examples.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.ByteAndHex/vb/ByteAndHex_Examples.vb" id="Snippet2":::
-
- The structure assumes that negative values are stored by using two's complement representation. Because the structure represents a numeric value with no fixed length, the constructor always interprets the most significant bit of the last byte in the array as a sign bit. To prevent the constructor from confusing the two's complement representation of a negative value with the sign and magnitude representation of a positive value, positive values in which the most significant bit of the last byte in the byte array would ordinarily be set should include an additional byte whose value is 0. For example, 0xC0 0xBD 0xF0 0xFF is the little-endian hexadecimal representation of either -1,000,000 or 4,293,967,296. Because the most significant bit of the last byte in this array is on, the value of the byte array would be interpreted by the constructor as -1,000,000. To instantiate a whose value is positive, a byte array whose elements are 0xC0 0xBD 0xF0 0xFF 0x00 must be passed to the constructor. The following example illustrates this.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/ByteAndHex_Examples.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.ByteAndHex/vb/ByteAndHex_Examples.vb" id="Snippet3":::
-
- Byte arrays created by the method from positive values include this extra zero-value byte. Therefore, the structure can successfully round-trip values by assigning them to, and then restoring them from, byte arrays, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/ByteAndHex_Examples.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.ByteAndHex/vb/ByteAndHex_Examples.vb" id="Snippet4":::
-
- However, you may need to add this additional zero-value byte to byte arrays that are created dynamically by the developer or that are returned by methods that convert unsigned integers to byte arrays (such as , , and ).
-
- When parsing a hexadecimal string, the and methods assume that if the most significant bit of the first byte in the string is set, or if the first hexadecimal digit of the string represents the lower four bits of a byte value, the value is represented by using two's complement representation. For example, both "FF01" and "F01" represent the decimal value -255. To differentiate positive from negative values, positive values should include a leading zero. The relevant overloads of the method, when they are passed the "X" format string, add a leading zero to the returned hexadecimal string for positive values. This makes it possible to round-trip values by using the and methods, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/ByteAndHex_Examples.cs" id="Snippet5":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.ByteAndHex/vb/ByteAndHex_Examples.vb" id="Snippet5":::
-
- However, the hexadecimal strings created by calling the `ToString` methods of the other integral types or the overloads of the method that include a `toBase` parameter do not indicate the sign of the value or the source data type from which the hexadecimal string was derived. Successfully instantiating a value from such a string requires some additional logic. The following example provides one possible implementation.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Overview/ByteAndHex_Examples2.cs" id="Snippet6":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Class.ByteAndHex/vb/ByteAndHex_Examples2.vb" id="Snippet6":::
-
- ]]>
-
+ For more information about this API, see Supplemental API remarks for BigInteger.
@@ -402,48 +285,48 @@
An array of byte values in little-endian order.
Initializes a new instance of the structure using the values in a byte array.
- and , return byte arrays in little-endian order.
-
- The constructor expects positive values in the byte array to use sign-and-magnitude representation, and negative values to use two's complement representation. In other words, if the highest-order bit of the highest-order byte in `value` is set, the resulting value is negative. Depending on the source of the byte array, this may cause a positive value to be misinterpreted as a negative value. Byte arrays are typically generated in the following ways:
-
-- By calling the method. Because this method returns a byte array with the highest-order bit of the highest-order byte in the array set to zero for positive values, there is no chance of misinterpreting a positive value as negative. Unmodified byte arrays created by the method always successfully round-trip when they are passed to the constructor.
-
-- By calling the method and passing it a signed integer as a parameter. Because signed integers handle both sign-and-magnitude representation and two's complement representation, there is no chance of misinterpreting a positive value as negative.
-
-- By calling the method and passing it an unsigned integer as a parameter. Because unsigned integers are represented by their magnitude only, positive values can be misinterpreted as negative values. To prevent this misinterpretation, you can add a zero-byte value to the end of the array. The example in the next section provides an illustration.
-
-- By creating a byte array either dynamically or statically without necessarily calling any of the previous methods, or by modifying an existing byte array. To prevent positive values from being misinterpreted as negative values, you can add a zero-byte value to the end of the array.
-
- If `value` is an empty array, the new object is initialized to a value of . If `value` is `null`, the constructor throws an .
-
-
-
-## Examples
- The following example instantiates a object from a 5-element byte array whose value is {5, 4, 3, 2, 1}. It then displays the value, represented as both decimal and hexadecimal numbers, to the console. A comparison of the input array with the text output makes it clear why this overload of the class constructor creates a object whose value is 4328719365 (or 0x102030405). The first element of the byte array, whose value is 5, defines the value of the lowest-order byte of the object, which is 0x05. The second element of the byte array, whose value is 4, defines the value of the second byte of the object, which is 0x04, and so on.
-
+ and , return byte arrays in little-endian order.
+
+ The constructor expects positive values in the byte array to use sign-and-magnitude representation, and negative values to use two's complement representation. In other words, if the highest-order bit of the highest-order byte in `value` is set, the resulting value is negative. Depending on the source of the byte array, this may cause a positive value to be misinterpreted as a negative value. Byte arrays are typically generated in the following ways:
+
+- By calling the method. Because this method returns a byte array with the highest-order bit of the highest-order byte in the array set to zero for positive values, there is no chance of misinterpreting a positive value as negative. Unmodified byte arrays created by the method always successfully round-trip when they are passed to the constructor.
+
+- By calling the method and passing it a signed integer as a parameter. Because signed integers handle both sign-and-magnitude representation and two's complement representation, there is no chance of misinterpreting a positive value as negative.
+
+- By calling the method and passing it an unsigned integer as a parameter. Because unsigned integers are represented by their magnitude only, positive values can be misinterpreted as negative values. To prevent this misinterpretation, you can add a zero-byte value to the end of the array. The example in the next section provides an illustration.
+
+- By creating a byte array either dynamically or statically without necessarily calling any of the previous methods, or by modifying an existing byte array. To prevent positive values from being misinterpreted as negative values, you can add a zero-byte value to the end of the array.
+
+ If `value` is an empty array, the new object is initialized to a value of . If `value` is `null`, the constructor throws an .
+
+
+
+## Examples
+ The following example instantiates a object from a 5-element byte array whose value is {5, 4, 3, 2, 1}. It then displays the value, represented as both decimal and hexadecimal numbers, to the console. A comparison of the input array with the text output makes it clear why this overload of the class constructor creates a object whose value is 4328719365 (or 0x102030405). The first element of the byte array, whose value is 5, defines the value of the lowest-order byte of the object, which is 0x05. The second element of the byte array, whose value is 4, defines the value of the second byte of the object, which is 0x04, and so on.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example1.vb" id="Snippet1":::
-
- The following example instantiates a positive and a negative value, passes them to the method, and then restores the original values from the resulting byte array. Note that the two values are represented by identical byte arrays. The only difference between them is in the most significant bit of the last element in the byte array. This bit is set (the value of the byte is 0xFF) if the array is created from a negative value. The bit is not set (the value of the byte is zero), if the array is created from a positive value.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example1.vb" id="Snippet1":::
+
+ The following example instantiates a positive and a negative value, passes them to the method, and then restores the original values from the resulting byte array. Note that the two values are represented by identical byte arrays. The only difference between them is in the most significant bit of the last element in the byte array. This bit is set (the value of the byte is 0xFF) if the array is created from a negative value. The bit is not set (the value of the byte is zero), if the array is created from a positive value.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example1.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example1.vb" id="Snippet2":::
-
- The following example illustrates how to make sure that a positive value is not incorrectly instantiated as a negative value by adding a byte whose value is zero to the end of the array.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example1.vb" id="Snippet2":::
+
+ The following example illustrates how to make sure that a positive value is not incorrectly instantiated as a negative value by adding a byte whose value is zero to the end of the array.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example1.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example1.vb" id="Snippet3":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example1.vb" id="Snippet3":::
+
]]>
@@ -487,21 +370,21 @@
A decimal number.
Initializes a new instance of the structure using a value.
- value to a variable.
-
- Calling this constructor can cause data loss; any fractional part of `value` is truncated when instantiating a object.
-
-
-
-## Examples
- The following example illustrates the use of the constructor to instantiate a object. It defines an array of values, and then passes each value to the constructor. Note that the value is truncated instead of rounded when it is assigned to the object.
-
+ value to a variable.
+
+ Calling this constructor can cause data loss; any fractional part of `value` is truncated when instantiating a object.
+
+
+
+## Examples
+ The following example illustrates the use of the constructor to instantiate a object. It defines an array of values, and then passes each value to the constructor. Note that the value is truncated instead of rounded when it is assigned to the object.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example2.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet4":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet4":::
+
]]>
@@ -542,23 +425,23 @@
A double-precision floating-point value.
Initializes a new instance of the structure using a double-precision floating-point value.
- object.
-
- Because of the lack of precision of the data type, calling this constructor can cause data loss.
-
- The value that results from calling this constructor is identical to the value that results from explicitly assigning a value to a .
-
-
-
-## Examples
- The following example illustrates the use of the constructor to instantiate a object. It also illustrates the loss of precision that may occur when you use the data type. A is assigned a large value, which is then assigned to a object. As the output shows, this assignment involves a loss of precision. Both values are then incremented by one. The output shows that the object reflects the changed value, whereas the object does not.
-
+ object.
+
+ Because of the lack of precision of the data type, calling this constructor can cause data loss.
+
+ The value that results from calling this constructor is identical to the value that results from explicitly assigning a value to a .
+
+
+
+## Examples
+ The following example illustrates the use of the constructor to instantiate a object. It also illustrates the loss of precision that may occur when you use the data type. A is assigned a large value, which is then assigned to a object. As the output shows, this assignment involves a loss of precision. Both values are then incremented by one. The output shows that the object reflects the changed value, whereas the object does not.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example2.cs" id="Snippet5":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet5":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet5":::
+
]]>
@@ -601,23 +484,23 @@
A 32-bit signed integer.
Initializes a new instance of the structure using a 32-bit signed integer value.
- object by using this constructor.
-
- The value that results from calling this constructor is identical to the value that results from assigning an value to a .
-
- The structure does not include constructors with a parameter of type , , , or . However, the type supports the implicit conversion of 8-bit and 16-bit signed and unsigned integers to signed 32-bit integers. As a result, this constructor is called if `value` is any one of these four integral types.
-
-
-
-## Examples
- The following example calls the constructor to instantiate values from an array of 32-bit integers. It also uses implicit conversion to assign each 32-bit integer value to a variable. It then compares the two values to establish that the resulting values are the same.
-
+ object by using this constructor.
+
+ The value that results from calling this constructor is identical to the value that results from assigning an value to a .
+
+ The structure does not include constructors with a parameter of type , , , or . However, the type supports the implicit conversion of 8-bit and 16-bit signed and unsigned integers to signed 32-bit integers. As a result, this constructor is called if `value` is any one of these four integral types.
+
+
+
+## Examples
+ The following example calls the constructor to instantiate values from an array of 32-bit integers. It also uses implicit conversion to assign each 32-bit integer value to a variable. It then compares the two values to establish that the resulting values are the same.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example2.cs" id="Snippet6":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet6":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet6":::
+
]]>
@@ -658,21 +541,21 @@
A 64-bit signed integer.
Initializes a new instance of the structure using a 64-bit signed integer value.
- object by using this constructor.
-
- The value that results from calling this constructor is identical to the value that results from assigning an value to a .
-
-
-
-## Examples
- The following example calls the constructor to instantiate values from an array of 64-bit integers. It also uses implicit conversion to assign each 64-bit integer value to a variable. It then compares the two values to establish that the resulting values are the same.
-
+ object by using this constructor.
+
+ The value that results from calling this constructor is identical to the value that results from assigning an value to a .
+
+
+
+## Examples
+ The following example calls the constructor to instantiate values from an array of 64-bit integers. It also uses implicit conversion to assign each 64-bit integer value to a variable. It then compares the two values to establish that the resulting values are the same.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example2.cs" id="Snippet7":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet7":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet7":::
+
]]>
@@ -713,23 +596,23 @@
A single-precision floating-point value.
Initializes a new instance of the structure using a single-precision floating-point value.
- object.
-
- Because of the lack of precision of the data type, calling this constructor can result in data loss.
-
- The value that results from calling this constructor is identical to the value that results from explicitly assigning a value to a .
-
-
-
-## Examples
- The following example illustrates the use of the constructor to instantiate a object. It also illustrates the loss of precision that may occur when you use the data type. A is assigned a large negative value, which is then assigned to a object. As the output shows, this assignment involves a loss of precision. Both values are then incremented by one. The output shows that the object reflects the changed value, whereas the object does not.
-
+ object.
+
+ Because of the lack of precision of the data type, calling this constructor can result in data loss.
+
+ The value that results from calling this constructor is identical to the value that results from explicitly assigning a value to a .
+
+
+
+## Examples
+ The following example illustrates the use of the constructor to instantiate a object. It also illustrates the loss of precision that may occur when you use the data type. A is assigned a large negative value, which is then assigned to a object. As the output shows, this assignment involves a loss of precision. Both values are then incremented by one. The output shows that the object reflects the changed value, whereas the object does not.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example2.cs" id="Snippet8":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet8":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet8":::
+
]]>
@@ -778,21 +661,21 @@
An unsigned 32-bit integer value.
Initializes a new instance of the structure using an unsigned 32-bit integer value.
- using this constructor.
-
- The value that results from calling this constructor is identical to the value that results from assigning a value to a .
-
-
-
-## Examples
- The following example uses the constructor and an assignment statement to initialize values from an array of unsigned 32-bit integers. It then compares the two values to demonstrate that the two methods of initializing a value produce identical results.
-
+ using this constructor.
+
+ The value that results from calling this constructor is identical to the value that results from assigning a value to a .
+
+
+
+## Examples
+ The following example uses the constructor and an assignment statement to initialize values from an array of unsigned 32-bit integers. It then compares the two values to demonstrate that the two methods of initializing a value produce identical results.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example2.cs" id="Snippet9":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet9":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet9":::
+
]]>
@@ -840,21 +723,21 @@
An unsigned 64-bit integer.
Initializes a new instance of the structure with an unsigned 64-bit integer value.
- using this constructor.
-
- The value that results from calling this constructor is identical to the value that results from assigning a value to a .
-
-
-
-## Examples
- The following example uses the constructor to instantiate a object whose value is equal to .
-
+ using this constructor.
+
+ The value that results from calling this constructor is identical to the value that results from assigning a value to a .
+
+
+
+## Examples
+ The following example uses the constructor to instantiate a object whose value is equal to .
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/.ctor/Example2.cs" id="Snippet10":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet10":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ctors/vb/Example2.vb" id="Snippet10":::
+
]]>
@@ -942,18 +825,18 @@
Gets the absolute value of a object.
The absolute value of .
- = 0|`value`|
-|`value` < 0|`value` * -1|
-
+ = 0|`value`|
+|`value` < 0|`value` * -1|
+
The method is equivalent to the method for the primitive numeric types.
-
+
]]>
@@ -1007,16 +890,16 @@
Adds two values and returns the result.
The sum of and .
- method to perform addition using values.
-
- The method is a useful substitute for the addition operator when instantiating a variable by assigning it a sum that results from addition, as shown in the following example.
-
+ method to perform addition using values.
+
+ The method is a useful substitute for the addition operator when instantiating a variable by assigning it a sum that results from addition, as shown in the following example.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Add/Multiply1.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.OperationMethods/vb/Multiply1.vb" id="Snippet2":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.OperationMethods/vb/Multiply1.vb" id="Snippet2":::
+
]]>
@@ -1102,34 +985,34 @@
The first value to compare.
The second value to compare.
Compares two values and returns an integer that indicates whether the first value is less than, equal to, or greater than the second value.
- A signed integer that indicates the relative values of and , as shown in the following table.
-
- Value
-
- Condition
-
- - Less than zero
-
- is less than .
-
-
- Zero
-
- equals .
-
-
- Greater than zero
-
- is greater than .
-
+ A signed integer that indicates the relative values of and , as shown in the following table.
+
+
Value
+
+ Condition
+
+ - Less than zero
+
+ is less than .
+
+
- Zero
+
+ equals .
+
+
- Greater than zero
+
+ is greater than .
+
- type has no fixed range, comparisons of values are not characterized by the lack of precision that characterizes the comparison of floating-point numbers. The following example compares two values that differ by one and that each have 1,896 digits. The method correctly reports that the two values are not equal.
-
+ type has no fixed range, comparisons of values are not characterized by the lack of precision that characterizes the comparison of floating-point numbers. The following example compares two values that differ by one and that each have 1,896 digits. The method correctly reports that the two values are not equal.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Compare/Compare1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Compare/vb/Compare1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Compare/vb/Compare1.vb" id="Snippet1":::
+
]]>
@@ -1183,39 +1066,39 @@
The signed 64-bit integer to compare.
Compares this instance to a signed 64-bit integer and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the signed 64-bit integer.
- A signed integer value that indicates the relationship of this instance to , as shown in the following table.
-
- Return value
-
- Description
-
- - Less than zero
-
- The current instance is less than .
-
-
- Zero
-
- The current instance equals .
-
-
- Greater than zero
-
- The current instance is greater than .
-
+ A signed integer value that indicates the relationship of this instance to , as shown in the following table.
+
+
Return value
+
+ Description
+
+ - Less than zero
+
+ The current instance is less than .
+
+
- Zero
+
+ The current instance equals .
+
+
- Greater than zero
+
+ The current instance is greater than .
+
- , , , , , or value, it is implicitly converted to an value when the method is called.
-
-
-
-## Examples
- The following example illustrates the result of calling the method with integral values.
-
+ , , , , , or value, it is implicitly converted to an value when the method is called.
+
+
+
+## Examples
+ The following example illustrates the result of calling the method with integral values.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/CompareTo/Example2.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.CompareTo/vb/Example2.vb" id="Snippet3":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.CompareTo/vb/Example2.vb" id="Snippet3":::
+
]]>
@@ -1261,44 +1144,44 @@
The object to compare.
Compares this instance to a second and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.
- A signed integer value that indicates the relationship of this instance to , as shown in the following table.
-
- Return value
-
- Description
-
- - Less than zero
-
- The current instance is less than .
-
-
- Zero
-
- The current instance equals .
-
-
- Greater than zero
-
- The current instance is greater than .
-
+ A signed integer value that indicates the relationship of this instance to , as shown in the following table.
+
+
Return value
+
+ Description
+
+ - Less than zero
+
+ The current instance is less than .
+
+
- Zero
+
+ The current instance equals .
+
+
- Greater than zero
+
+ The current instance is greater than .
+
- method implements the method. It is used by generic collection objects to order the items in the collection.
-
-
-
-## Examples
- The following example illustrates the use of the method to order a list of `StarInfo` objects. Each `StarInfo` object provides information about a star's name and its distance from the Earth in miles. `StarInfo` implements the interface, which enables `StarInfo` objects to be sorted by generic collection classes. Its implementation just wraps a call to .
-
+ method implements the method. It is used by generic collection objects to order the items in the collection.
+
+
+
+## Examples
+ The following example illustrates the use of the method to order a list of `StarInfo` objects. Each `StarInfo` object provides information about a star's name and its distance from the Earth in miles. `StarInfo` implements the interface, which enables `StarInfo` objects to be sorted by generic collection classes. Its implementation just wraps a call to .
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/CompareTo/Example1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.CompareTo/vb/Example1.vb" id="Snippet1":::
-
- The following code then instantiates four `StarInfo` objects and stores them in a generic object. After the method is called, `StarInfo` objects are displayed in order of their distance from the Earth.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.CompareTo/vb/Example1.vb" id="Snippet1":::
+
+ The following code then instantiates four `StarInfo` objects and stores them in a generic object. After the method is called, `StarInfo` objects are displayed in order of their distance from the Earth.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/CompareTo/Example1.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.CompareTo/vb/Example1.vb" id="Snippet2":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.CompareTo/vb/Example1.vb" id="Snippet2":::
+
]]>
@@ -1353,45 +1236,45 @@
The object to compare.
Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.
- A signed integer that indicates the relationship of the current instance to the parameter, as shown in the following table.
-
- Return value
-
- Description
-
- - Less than zero
-
- The current instance is less than .
-
-
- Zero
-
- The current instance equals .
-
-
- Greater than zero
-
- The current instance is greater than , or the parameter is .
-
+ A signed integer that indicates the relationship of the current instance to the parameter, as shown in the following table.
+
+
Return value
+
+ Description
+
+ - Less than zero
+
+ The current instance is less than .
+
+
- Zero
+
+ The current instance equals .
+
+
- Greater than zero
+
+ The current instance is greater than , or the parameter is .
+
- method implements the method. It is used by non-generic collection objects to order the items in the collection.
-
- The `obj` parameter must be one of the following:
-
-- An object whose run-time type is .
-
-- An variable whose value is `null`. If the value of the `obj` parameter is `null`, the method returns 1, which indicates that the current instance is greater than `obj`.
-
-
-
-## Examples
- The following example calls the method to compare a value with each element in an object array:
-
+ method implements the method. It is used by non-generic collection objects to order the items in the collection.
+
+ The `obj` parameter must be one of the following:
+
+- An object whose run-time type is .
+
+- An variable whose value is `null`. If the value of the `obj` parameter is `null`, the method returns 1, which indicates that the current instance is greater than `obj`.
+
+
+
+## Examples
+ The following example calls the method to compare a value with each element in an object array:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/CompareTo/Example2.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.CompareTo/vb/Example2.vb" id="Snippet4":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.CompareTo/vb/Example2.vb" id="Snippet4":::
+
]]>
@@ -1702,21 +1585,21 @@
Divides one value by another and returns the result.
The quotient of the division.
- method performs integer division; any remainder that results from the division is discarded. To perform integer division while preserving the remainder, call the method. To retrieve only the remainder, call the method.
-
- The method can be used by languages that do not support operator overloading. Its behavior is identical to division using the division operator.
-
-
-
-## Examples
- The following example creates an array of values. It then uses each element as the quotient in a division operation that uses the method, the division operator (/), and the method.
-
+ method performs integer division; any remainder that results from the division is discarded. To perform integer division while preserving the remainder, call the method. To retrieve only the remainder, call the method.
+
+ The method can be used by languages that do not support operator overloading. Its behavior is identical to division using the division operator.
+
+
+
+## Examples
+ The following example creates an array of values. It then uses each element as the quotient in a division operation that uses the method, the division operator (/), and the method.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Divide/Divide1.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Divide/vb/Divide1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Divide/vb/Divide1.vb" id="Snippet1":::
+
]]>
@@ -1814,23 +1697,23 @@
Divides one value by another, returns the result, and returns the remainder in an output parameter.
The quotient of the division.
- method or the division operator; if you are only interested in the remainder, use the method.
-
- The sign of the returned `remainder` value is the same as the sign of the `dividend` parameter.
-
- The behavior of the method is identical to that of the method.
-
-
-
-## Examples
- The following example creates an array of values. It then uses each element as the quotient in a division operation that uses the method, the division operator (/), and the method.
-
+ method or the division operator; if you are only interested in the remainder, use the method.
+
+ The sign of the returned `remainder` value is the same as the sign of the `dividend` parameter.
+
+ The behavior of the method is identical to that of the method.
+
+
+
+## Examples
+ The following example creates an array of values. It then uses each element as the quotient in a division operation that uses the method, the division operator (/), and the method.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Divide/Divide1.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Divide/vb/Divide1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Divide/vb/Divide1.vb" id="Snippet1":::
+
]]>
@@ -1888,22 +1771,22 @@
if the signed 64-bit integer and the current instance have the same value; otherwise, .
- , , , , , or value, it is implicitly converted to an value when the method is called.
-
- To determine the relationship between the two objects instead of just testing for equality, call the method.
-
-
-
-## Examples
- The following example instantiates a object from each integral type except . It then calls the method to compare the value with the original integer value that was passed to the constructor. As the output shows, the values are equal in each case.
-
+ , , , , , or value, it is implicitly converted to an value when the method is called.
+
+ To determine the relationship between the two objects instead of just testing for equality, call the method.
+
+
+
+## Examples
+ The following example instantiates a object from each integral type except . It then calls the method to compare the value with the original integer value that was passed to the constructor. As the output shows, the values are equal in each case.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Equals/EqualsExample1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet1":::
+
]]>
@@ -1952,22 +1835,22 @@
if this object and have the same value; otherwise, .
- interface and performs slightly better than because it does not have to convert the `other` parameter to a object.
-
- To determine the relationship between the two objects instead of just testing for equality, call the method.
-
-
-
-## Examples
- The following example compares the approximate distance of several stars from Earth with the distance of Epsilon Indi from Earth to determine whether they are equal. The example uses each overload of the method to test for equality.
-
+ interface and performs slightly better than because it does not have to convert the `other` parameter to a object.
+
+ To determine the relationship between the two objects instead of just testing for equality, call the method.
+
+
+
+## Examples
+ The following example compares the approximate distance of several stars from Earth with the distance of Epsilon Indi from Earth to determine whether they are equal. The example uses each overload of the method to test for equality.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Equals/EqualsExample1.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet2":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet2":::
+
]]>
@@ -2027,21 +1910,21 @@
if the argument is a object, and its value is equal to the value of the current instance; otherwise, .
- value, the method returns `false`. The method returns `true` only if `obj` is a instance whose value is equal to the current instance.
-
- To determine the relationship between the two objects instead of just testing for equality, call the method.
-
-
-
-## Examples
- The following example defines parallel and arrays. Each element of one array has the same value as the corresponding element of the second array. As the output from the example shows, the instance in the array is considered to be equal to the instance in the array only if the latter is a and their values are equal.
-
+ value, the method returns `false`. The method returns `true` only if `obj` is a instance whose value is equal to the current instance.
+
+ To determine the relationship between the two objects instead of just testing for equality, call the method.
+
+
+
+## Examples
+ The following example defines parallel and arrays. Each element of one array has the same value as the corresponding element of the second array. As the output from the example shows, the instance in the array is considered to be equal to the instance in the array only if the latter is a and their values are equal.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Equals/Equals_Obj1.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/Equals_Obj1.vb" id="Snippet3":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/Equals_Obj1.vb" id="Snippet3":::
+
]]>
@@ -2093,20 +1976,20 @@
if the current instance and the unsigned 64-bit integer have the same value; otherwise, .
- method.
-
-
-
-## Examples
- The following example compares the approximate distance of several stars from Earth with the distance of Epsilon Indi from Earth to determine whether they are equal. The example uses each overload of the method to test for equality.
-
+ method.
+
+
+
+## Examples
+ The following example compares the approximate distance of several stars from Earth with the distance of Epsilon Indi from Earth to determine whether they are equal. The example uses each overload of the method to test for equality.
+
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Equals/EqualsExample1.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet2":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet2":::
+
]]>
@@ -2268,26 +2151,26 @@ This method returns 0 if the value of current object is equal to Finds the greatest common divisor of two values.
The greatest common divisor of and .
- values can be divided without returning a remainder.
-
- If the `left` and `right` parameters are non-zero numbers, the method always returns at least a value of 1 because all numbers can be divided by 1. If either parameter is zero, the method returns the absolute value of the non-zero parameter. If both values are zero, the method returns zero.
-
+ values can be divided without returning a remainder.
+
+ If the `left` and `right` parameters are non-zero numbers, the method always returns at least a value of 1 because all numbers can be divided by 1. If either parameter is zero, the method returns the absolute value of the non-zero parameter. If both values are zero, the method returns zero.
+
> [!NOTE]
-> Computing the greatest common divisor of very large values of `left` and `right` can be a very time-consuming operation.
-
- The value returned by the method is always positive regardless of the sign of the `left` and `right` parameters.
-
-
-
-## Examples
- The following example illustrates a call to the method and the exception handling necessary to provide useful information about an . The result indicates that the greatest common divisor of these two numbers is 1.
-
+> Computing the greatest common divisor of very large values of `left` and `right` can be a very time-consuming operation.
+
+ The value returned by the method is always positive regardless of the sign of the `left` and `right` parameters.
+
+
+
+## Examples
+ The following example illustrates a call to the method and the exception handling necessary to provide useful information about an . The result indicates that the greatest common divisor of these two numbers is 1.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet10":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet10":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet10":::
+
]]>
@@ -2329,21 +2212,21 @@ This method returns 0 if the value of current object is equal to
if the value of the object is an even number; otherwise, .
- value is evenly divisible by two. It is equivalent to the following expression:
-
-```csharp
-value % 2 == 0;
-```
-
-```vb
-value Mod 2 = 0
-```
-
- If the value of the current object is , the property returns `true`.
-
+ value is evenly divisible by two. It is equivalent to the following expression:
+
+```csharp
+value % 2 == 0;
+```
+
+```vb
+value Mod 2 = 0
+```
+
+ If the value of the current object is , the property returns `true`.
+
]]>
@@ -2524,11 +2407,11 @@ A return value of `false` does not imply that
if the value of the object is ; otherwise, .
-
@@ -2653,11 +2536,11 @@ A return value of `false` does not imply that
if the value of the object is a power of two; otherwise, .
- value has a single non-zero bit set. This means that it returns `true` if the value of the current object is 1 (that is, 20) or any greater power of two. It returns `false` if the value of the current object is 0.
-
+ value has a single non-zero bit set. This means that it returns `true` if the value of the current object is 1 (that is, 20) or any greater power of two. It returns `false` if the value of the current object is 0.
+
]]>
@@ -2699,11 +2582,11 @@ A return value of `false` does not imply that
if the value of the object is ; otherwise, .
-
@@ -2801,28 +2684,28 @@ A return value of `false` does not imply that Returns the natural (base ) logarithm of a specified number.
The natural (base ) logarithm of , as shown in the table in the Remarks section.
- .|
-|Negative|.|
-
- To calculate the base 10 logarithm of a value, call the method. To calculate the logarithm of a number in another base, call the method.
-
- You can find the square root of a number by calling the method along with the method. Note that the result is if the result is greater than . The following example calculates the square root of each element in an array of values.
-
+ .|
+|Negative|.|
+
+ To calculate the base 10 logarithm of a value, call the method. To calculate the logarithm of a number in another base, call the method.
+
+ You can find the square root of a number by calling the method along with the method. Note that the result is if the result is greater than . The following example calculates the square root of each element in an array of values.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/LogMethod/log1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.numerics.biginteger.log/vb/log1.vb" id="Snippet1":::
-
- This method corresponds to the method for the primitive numeric types.
-
+
+ This method corresponds to the method for the primitive numeric types.
+
]]>
The natural log of is out of range of the data type.
@@ -2871,31 +2754,31 @@ A return value of `false` does not imply that Returns the logarithm of a specified number in a specified base.
The base logarithm of , as shown in the table in the Remarks section.
- 0|(0 < `baseValue` < 1) -or-(`baseValue` > 1)|logbaseValue(`value`)|
-|`value` < 0|(any value)||
-|(any value)|`baseValue` < 0||
-|`value` != 1|`baseValue` = 0||
-|`value` != 1|`baseValue` = ||
-|(any value)|`baseValue` = ||
-|(any value)|`baseValue` = 1||
-|`value` = 0|0 < `baseValue` < 1||
-|`value` = 0|`baseValue` > 1||
-|`value` = 1|`baseValue` = 0|0|
-|`value` = 1|`baseValue` = |0|
-
- To calculate the base 10 logarithm of a value, call the method. To calculate the natural logarithm of a number, call the method.
-
- This method corresponds to the method for the primitive numeric types.
-
+ 0|(0 < `baseValue` < 1) -or-(`baseValue` > 1)|logbaseValue(`value`)|
+|`value` < 0|(any value)||
+|(any value)|`baseValue` < 0||
+|`value` != 1|`baseValue` = 0||
+|`value` != 1|`baseValue` = ||
+|(any value)|`baseValue` = ||
+|(any value)|`baseValue` = 1||
+|`value` = 0|0 < `baseValue` < 1||
+|`value` = 0|`baseValue` > 1||
+|`value` = 1|`baseValue` = 0|0|
+|`value` = 1|`baseValue` = |0|
+
+ To calculate the base 10 logarithm of a value, call the method. To calculate the natural logarithm of a number, call the method.
+
+ This method corresponds to the method for the primitive numeric types.
+
]]>
The log of is out of range of the data type.
@@ -2948,23 +2831,23 @@ A return value of `false` does not imply that Returns the base 10 logarithm of a specified number.
The base 10 logarithm of , as shown in the table in the Remarks section.
- .|
-|Negative|.|
-
- To calculate the natural logarithm of a value, call the method. To calculate the logarithm of a number in another base, call the method.
-
- This method corresponds to the method for the primitive numeric types.
-
+ .|
+|Negative|.|
+
+ To calculate the natural logarithm of a value, call the method. To calculate the logarithm of a number in another base, call the method.
+
+ This method corresponds to the method for the primitive numeric types.
+
]]>
The base 10 log of is out of range of the data type.
@@ -3052,19 +2935,19 @@ A return value of `false` does not imply that Returns the larger of two values.
The or parameter, whichever is larger.
- method for primitive numeric types.
-
-
-
-## Examples
- The following example uses the method to select the largest number in an array of values.
-
+ method for primitive numeric types.
+
+
+
+## Examples
+ The following example uses the method to select the largest number in an array of values.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Max/Max1.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Max/vb/Max1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Max/vb/Max1.vb" id="Snippet1":::
+
]]>
@@ -3163,19 +3046,19 @@ For this method matches the IEE
Returns the smaller of two values.
The or parameter, whichever is smaller.
- method for primitive numeric types.
-
-
-
-## Examples
- The following example uses the method to select the smallest number in an array of values.
-
+ method for primitive numeric types.
+
+
+
+## Examples
+ The following example uses the method to select the smallest number in an array of values.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Min/Min1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Min/vb/Min1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Min/vb/Min1.vb" id="Snippet1":::
+
]]>
@@ -3270,11 +3153,11 @@ For this method matches the IEE
Gets a value that represents the number negative one (-1).
An integer whose value is negative one (-1).
- property is used to compare a value to -1 or to assign -1 to a object.
-
+ property is used to compare a value to -1 or to assign -1 to a object.
+
]]>
@@ -3325,20 +3208,20 @@ For this method matches the IEE
Performs modulus division on a number raised to the power of another number.
The remainder after dividing exponent by .
- method evaluates the following expression:
-
- (baseValue ^ exponent) Mod modulus
-
- To perform exponentiation on values without modulus division, use the method.
-
-
-
-## Examples
- The following example provides a simple illustration of calling the method.
-
+ method evaluates the following expression:
+
+ (baseValue ^ exponent) Mod modulus
+
+ To perform exponentiation on values without modulus division, use the method.
+
+
+
+## Examples
+ The following example provides a simple illustration of calling the method.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/ModPow/ModPow1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.ModPow/vb/ModPow1.vb" id="Snippet1":::
@@ -3399,24 +3282,24 @@ For this method matches the IEE
Returns the product of two values.
The product of the and parameters.
- method is implemented for languages that do not support operator overloading. Its behavior is identical to multiplication using the multiplication operator. In addition, the method is a useful substitute for the multiplication operator when instantiating a variable by assigning it a product that results from multiplication, as shown in the following example.
-
+ method is implemented for languages that do not support operator overloading. Its behavior is identical to multiplication using the multiplication operator. In addition, the method is a useful substitute for the multiplication operator when instantiating a variable by assigning it a product that results from multiplication, as shown in the following example.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Add/Multiply1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.OperationMethods/vb/Multiply1.vb" id="Snippet1":::
-
- If necessary, this method automatically performs implicit conversion of other integral types to objects. This is illustrated in the example in the next section, where the method is passed two values.
-
-
-
-## Examples
- The following example tries to perform multiplication with two long integers. Because the result exceeds the range of a long integer, an is thrown, and the method is called to handle the multiplication. Note that C# requires that you use either the `checked` keyword (as in this example) or the `/checked+` compiler option to make sure an exception is thrown on a numeric overflow.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.OperationMethods/vb/Multiply1.vb" id="Snippet1":::
+
+ If necessary, this method automatically performs implicit conversion of other integral types to objects. This is illustrated in the example in the next section, where the method is passed two values.
+
+
+
+## Examples
+ The following example tries to perform multiplication with two long integers. Because the result exceeds the range of a long integer, an is thrown, and the method is called to handle the multiplication. Note that C# requires that you use either the `checked` keyword (as in this example) or the `/checked+` compiler option to make sure an exception is thrown on a numeric overflow.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet7":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet7":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet7":::
+
]]>
@@ -3468,24 +3351,24 @@ For this method matches the IEE
Negates a specified value.
The result of the parameter multiplied by negative one (-1).
- method is implemented for languages that do not support custom operators. Its behavior is identical to negation using the unary negation operator. In addition, the method is a useful substitute for the negation operator when instantiating a variable, as shown in the following example.
-
+ method is implemented for languages that do not support custom operators. Its behavior is identical to negation using the unary negation operator. In addition, the method is a useful substitute for the negation operator when instantiating a variable, as shown in the following example.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Add/Multiply1.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.OperationMethods/vb/Multiply1.vb" id="Snippet4":::
-
-
-
-## Examples
- The following example illustrates three ways to negate the value of a object.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.OperationMethods/vb/Multiply1.vb" id="Snippet4":::
+
+
+
+## Examples
+ The following example illustrates three ways to negate the value of a object.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet16":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet16":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet16":::
+
]]>
@@ -3537,11 +3420,11 @@ For this method matches the IEE
Gets a value that represents the number one (1).
An object whose value is one (1).
- property is usually used to compare a value to 1 or to assign 1 to a object.
-
+ property is usually used to compare a value to 1 or to assign 1 to a object.
+
]]>
@@ -3594,16 +3477,16 @@ For this method matches the IEE
Adds the values of two specified objects.
The sum of and .
- method defines the addition operation for values. It enables code such as the following:
-
+ method defines the addition operation for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet12":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet12":::
-
- Languages that do not support custom operators can call the method instead.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet12":::
+
+ Languages that do not support custom operators can call the method instead.
+
]]>
@@ -3655,25 +3538,25 @@ For this method matches the IEE
Performs a bitwise operation on two values.
The result of the bitwise operation.
- method defines the bitwise `And` operation for values. The bitwise `And` operation sets a result bit only if the corresponding bits in `left` and `right` are also set, as shown in the following table.
-
-|Bit in `left`|Bit in `right`|Bit in result|
-|-------------------|--------------------|-------------------|
-|0|0|0|
-|1|0|0|
-|1|1|1|
-|0|1|0|
-
- The method enables code such as the following:
-
+ method defines the bitwise `And` operation for values. The bitwise `And` operation sets a result bit only if the corresponding bits in `left` and `right` are also set, as shown in the following table.
+
+|Bit in `left`|Bit in `right`|Bit in result|
+|-------------------|--------------------|-------------------|
+|0|0|0|
+|1|0|0|
+|1|1|1|
+|0|1|0|
+
+ The method enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet1":::
-
- The method performs the bitwise `And` operation on two values as if they were both in two's complement representation with virtual sign extension.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet1":::
+
+ The method performs the bitwise `And` operation on two values as if they were both in two's complement representation with virtual sign extension.
+
]]>
@@ -3724,25 +3607,25 @@ For this method matches the IEE
Performs a bitwise operation on two values.
The result of the bitwise operation.
- method defines the bitwise `Or` operation for values. The bitwise `Or` operation sets a result bit only if either or both of the corresponding bits in `left` and `right` are set, as shown in the following table.
-
-|Bit in `left`|Bit in `right`|Bit in result|
-|-------------------|--------------------|-------------------|
-|0|0|0|
-|1|0|1|
-|1|1|1|
-|0|1|1|
-
- The method enables code such as the following:
-
+ method defines the bitwise `Or` operation for values. The bitwise `Or` operation sets a result bit only if either or both of the corresponding bits in `left` and `right` are set, as shown in the following table.
+
+|Bit in `left`|Bit in `right`|Bit in result|
+|-------------------|--------------------|-------------------|
+|0|0|0|
+|1|0|1|
+|1|1|1|
+|0|1|1|
+
+ The method enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet2":::
-
- The method performs the bitwise `Or` operation on two values as if they were both in two's complement representation with virtual sign extension.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet2":::
+
+ The method performs the bitwise `Or` operation on two values as if they were both in two's complement representation with virtual sign extension.
+
]]>
@@ -3791,20 +3674,20 @@ For this method matches the IEE
Decrements a value by 1.
The value of the parameter decremented by 1.
- method defines the decrement operation for values. It enables code such as the following:
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet17":::
-
- Languages that do not support custom operators can call the method instead. For example:
-
+ method defines the decrement operation for values. It enables code such as the following:
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet17":::
+
+ Languages that do not support custom operators can call the method instead. For example:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet3":::
-
- Because objects are immutable, the operator creates a new object whose value is one less than the object represented by `value`. This means that repeated calls to may be expensive.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet3":::
+
+ Because objects are immutable, the operator creates a new object whose value is one less than the object represented by `value`. This means that repeated calls to may be expensive.
+
The equivalent method for this operator is .]]>
@@ -3856,24 +3739,24 @@ For this method matches the IEE
Divides a specified value by another specified value by using integer division.
The integral result of the division.
- method defines the division operation for values. It enables code such as the following:
-
+ method defines the division operation for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet13":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet13":::
-
- Languages that do not support custom operators and operator overloading can call the method instead.
-
- The equivalent method for this operator is
-
-## Examples
- The following example creates an array of values. It then uses each element as the quotient in a division operation that uses the method, the division operator (/), and the method.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet13":::
+
+ Languages that do not support custom operators and operator overloading can call the method instead.
+
+ The equivalent method for this operator is
+
+## Examples
+ The following example creates an array of values. It then uses each element as the quotient in a division operation that uses the method, the division operator (/), and the method.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Divide/Divide1.cs" interactive="try-dotnet" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Divide/vb/Divide1.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Divide/vb/Divide1.vb" id="Snippet1":::
+
]]>
@@ -3934,18 +3817,18 @@ For this method matches the IEE
if the and parameters have the same value; otherwise, .
- method defines the equality comparison operation for values. It enables code such as the following:
-
+ method defines the equality comparison operation for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet4":::
-
- Languages that do not support custom operators can call the instance method instead.
-
- If `left` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet4":::
+
+ Languages that do not support custom operators can call the instance method instead.
+
+ If `left` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
+
The equivalent method for this operator is .]]>
@@ -3994,18 +3877,18 @@ For this method matches the IEE
if the and parameters have the same value; otherwise, .
- method defines the equality comparison operation for values. It enables code such as the following:
-
+ method defines the equality comparison operation for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet5":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet5":::
-
- Languages that do not support custom operators can call the instance method instead.
-
- If `right` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet5":::
+
+ Languages that do not support custom operators can call the instance method instead.
+
+ If `right` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
+
The equivalent method for this operator is .]]>
@@ -4058,16 +3941,16 @@ For this method matches the IEE
if the and parameters have the same value; otherwise, .
- method defines the operation of the equality operator for values. It enables code such as the following:
-
+ method defines the operation of the equality operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet19":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet19":::
-
- Languages that do not support custom operators can call the instance method instead.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet19":::
+
+ Languages that do not support custom operators can call the instance method instead.
+
The equivalent method for this operator is .]]>
@@ -4123,16 +4006,16 @@ For this method matches the IEE
if the and parameters have the same value; otherwise, .
- method defines the equality comparison operation for values. It enables code such as the following:
-
+ method defines the equality comparison operation for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet6":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet6":::
-
- Languages that do not support custom operators can call the instance method instead.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet6":::
+
+ Languages that do not support custom operators can call the instance method instead.
+
]]>
@@ -4187,16 +4070,16 @@ For this method matches the IEE
if the and parameters have the same value; otherwise, .
- method defines the equality comparison operation for values. It enables code such as the following:
-
+ method defines the equality comparison operation for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet7":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet7":::
-
- Languages that do not support custom operators can call the instance method instead.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet7":::
+
+ Languages that do not support custom operators can call the instance method instead.
+
]]>
@@ -4248,25 +4131,25 @@ For this method matches the IEE
Performs a bitwise exclusive () operation on two values.
The result of the bitwise operation.
- method enables code such as the following:
-
+ method enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet8":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet8":::
-
- The method performs the bitwise exclusive `Or` operation on two values as if they were both in two's complement representation with virtual sign extension.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet8":::
+
+ The method performs the bitwise exclusive `Or` operation on two values as if they were both in two's complement representation with virtual sign extension.
+
]]>
@@ -4321,21 +4204,21 @@ For this method matches the IEE
Defines an explicit conversion of a object to a value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Because the conversion from to can involve truncating any fractional part of `value`, language compilers do not perform this conversion automatically. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` in Visual Basic) is used. Otherwise, they display a compiler error.
+ The overloads of the method define the types to which or from which a object can be converted. Because the conversion from to can involve truncating any fractional part of `value`, language compilers do not perform this conversion automatically. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` in Visual Basic) is used. Otherwise, they display a compiler error.
For languages that do not support custom operators, the alternative method is .
## Examples
- The following example converts the individual elements in an array of values to objects, and then displays the result of each conversion. Note that any fractional part of a value is truncated during the conversion.
+ The following example converts the individual elements in an array of values to objects, and then displays the result of each conversion. Note that any fractional part of a value is truncated during the conversion.
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet1":::
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet1":::
]]>
@@ -4381,9 +4264,9 @@ For this method matches the IEE
Defines an explicit conversion of a value to a value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Because the conversion from to can involve truncating any fractional part of `value`, language compilers do not perform this conversion automatically. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` in Visual Basic) is used. Otherwise, they display a compiler error.
@@ -4392,10 +4275,10 @@ For this method matches the IEE
## Examples
- The following example converts the individual elements in an array of values to objects, and then displays the result of each conversion. Note that any fractional part of a value is truncated during the conversion.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet2":::
+ The following example converts the individual elements in an array of values to objects, and then displays the result of each conversion. Note that any fractional part of a value is truncated during the conversion.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet2":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet2":::
]]>
@@ -4476,18 +4359,18 @@ For this method matches the IEE
Defines an explicit conversion of a object to an unsigned byte value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CByte` in Visual Basic) is used. Otherwise, they display a compiler error.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CByte` in Visual Basic) is used. Otherwise, they display a compiler error.
Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type. There is no loss of precision in the resulting value if the conversion is successful.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet1":::
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet1":::
]]>
@@ -4568,18 +4451,18 @@ For this method matches the IEE
Defines an explicit conversion of a object to a value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CDec` in Visual Basic) is used.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CDec` in Visual Basic) is used.
- Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type.
+ Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet2":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet2":::
]]>
@@ -4627,25 +4510,25 @@ For this method matches the IEE
Defines an explicit conversion of a object to a value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CDbl` in Visual Basic) is used.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CDbl` in Visual Basic) is used.
Because the value can be outside the range of the data type, this operation is a narrowing conversion. If the conversion is unsuccessful, it does not throw an . Instead, if the value is less than , the resulting value is . If the value is greater than , the resulting value is .
-
- The conversion of a to a may involve a loss of precision. In some cases, the loss of precision may cause the casting or conversion operation to succeed even if the value is outside the range of the data type. The following example provides an illustration. It assigns the maximum value of a to two variables, increments one variable by 9.999e291, and tests the two variables for equality. As expected, the call to the method shows that they are unequal. However, the conversion of the larger value back to a succeeds, although the value now exceeds .
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet4":::
+
+ The conversion of a to a may involve a loss of precision. In some cases, the loss of precision may cause the casting or conversion operation to succeed even if the value is outside the range of the data type. The following example provides an illustration. It assigns the maximum value of a to two variables, increments one variable by 9.999e291, and tests the two variables for equality. As expected, the call to the method shows that they are unequal. However, the conversion of the larger value back to a succeeds, although the value now exceeds .
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet4":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet4":::
## Examples
- The following example illustrates the conversion of to values.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet3":::
+ The following example illustrates the conversion of to values.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet3":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet3":::
]]>
@@ -4757,18 +4640,18 @@ For this method matches the IEE
Defines an explicit conversion of a object to a 16-bit signed integer value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CShort` in Visual Basic) is used. Otherwise, they display a compiler error.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CShort` in Visual Basic) is used. Otherwise, they display a compiler error.
Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type. There is no loss of precision in the resulting value if the conversion is successful.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet4":::
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet4":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet4":::
]]>
@@ -4816,18 +4699,18 @@ For this method matches the IEE
Defines an explicit conversion of a object to a 32-bit signed integer value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CInt` in Visual Basic) is used. Otherwise, they display a compiler error.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CInt` in Visual Basic) is used. Otherwise, they display a compiler error.
Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type. There is no loss of precision in the resulting value if the conversion is successful.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet5":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet5":::
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet5":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet5":::
]]>
@@ -4875,18 +4758,18 @@ For this method matches the IEE
Defines an explicit conversion of a object to a 64-bit signed integer value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CLng` in Visual Basic) is used. Otherwise, they display a compiler error.
+ at run time if the value is outside the range of the data type.
+## Remarks
+ The overloads of the method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CLng` in Visual Basic) is used. Otherwise, they display a compiler error.
+
+ Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet6":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet6":::
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet6":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet6":::
]]>
@@ -4970,23 +4853,23 @@ For this method matches the IEE
The value to convert to a signed 8-bit value.
- Defines an explicit conversion of a object to a signed 8-bit value.
-
+ Defines an explicit conversion of a object to a signed 8-bit value.
+
This API is not CLS-compliant. The compliant alternative is .
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CSByte` in Visual Basic) is used. Otherwise, they display a compiler error.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CSByte` in Visual Basic) is used. Otherwise, they display a compiler error.
Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type. There is no loss of precision in the resulting value if the conversion is successful.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet7":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet7":::
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet7":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet7":::
]]>
@@ -5035,25 +4918,25 @@ For this method matches the IEE
Defines an explicit conversion of a object to a single-precision floating-point value.
An object that contains the closest possible representation of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss or a loss of precision. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CSng` in Visual Basic) is used. Otherwise, they display a compiler error.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss or a loss of precision. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CSng` in Visual Basic) is used. Otherwise, they display a compiler error.
Because the value can be outside the range of the data type, this operation is a narrowing conversion. If the conversion is unsuccessful, it does not throw an . Instead, if the value is less than , the resulting value is . If the value is greater than , the resulting value is .
- The conversion of a to a may involve a loss of precision. In some cases, the loss of precision may cause the casting or conversion operation to succeed even if the value is outside the range of the data type. The following example provides an illustration. It assigns the maximum value of a to two variables, increments one variable by 9.999e291, and tests the two variables for equality. As expected, the call to the method shows that they are unequal. However, the conversion of the larger value back to a succeeds, although the value now exceeds .
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet5":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet5":::
+ The conversion of a to a may involve a loss of precision. In some cases, the loss of precision may cause the casting or conversion operation to succeed even if the value is outside the range of the data type. The following example provides an illustration. It assigns the maximum value of a to two variables, increments one variable by 9.999e291, and tests the two variables for equality. As expected, the call to the method shows that they are unequal. However, the conversion of the larger value back to a succeeds, although the value now exceeds .
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet5":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet5":::
## Examples
- The following example illustrates the conversion of to values.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet8":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet8":::
+ The following example illustrates the conversion of to values.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet8":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet8":::
]]>
@@ -5141,23 +5024,23 @@ For this method matches the IEE
The value to convert to an unsigned 16-bit integer.
- Defines an explicit conversion of a object to an unsigned 16-bit integer value.
-
+ Defines an explicit conversion of a object to an unsigned 16-bit integer value.
+
This API is not CLS-compliant. The compliant alternative is .
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CUShort` in Visual Basic) is used. Otherwise, they display a compiler error.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CUShort` in Visual Basic) is used. Otherwise, they display a compiler error.
Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type. There is no loss of precision in the resulting value if the conversion is successful.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet9":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet9":::
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet9":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet9":::
]]>
@@ -5209,23 +5092,23 @@ For this method matches the IEE
The value to convert to an unsigned 32-bit integer.
- Defines an explicit conversion of a object to an unsigned 32-bit integer value.
-
+ Defines an explicit conversion of a object to an unsigned 32-bit integer value.
+
This API is not CLS-compliant. The compliant alternative is .
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CUInt` in Visual Basic) is used. Otherwise, they display a compiler error.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CUInt` in Visual Basic) is used. Otherwise, they display a compiler error.
Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type. There is no loss of precision in the resulting value if the conversion is successful.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet10":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet10":::
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet10":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet10":::
]]>
@@ -5277,23 +5160,23 @@ For this method matches the IEE
The value to convert to an unsigned 64-bit integer.
- Defines an explicit conversion of a object to an unsigned 64-bit integer value.
-
+ Defines an explicit conversion of a object to an unsigned 64-bit integer value.
+
This API is not CLS-compliant. The compliant alternative is .
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CULng` in Visual Basic) is used. Otherwise, they display a compiler error.
+ method define the types to which or from which a object can be converted. Language compilers do not perform this conversion automatically because it can involve data loss. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` or `CULng` in Visual Basic) is used. Otherwise, they display a compiler error.
Because this operation defines a narrowing conversion, it can throw an at run time if the value is outside the range of the data type. There is no loss of precision in the resulting value if the conversion is successful.
## Examples
- The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet11":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet11":::
+ The following example illustrates the conversion of to values. It also handles an that is thrown because the value is outside the range of the data type.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/System.Numeric.BigInteger.Explicit.cs" id="Snippet11":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Explicit/vb/System.Numeric.BigInteger.Explicit.vb" id="Snippet11":::
]]>
@@ -5414,11 +5297,11 @@ For this method matches the IEE
Defines an explicit conversion of a value to a value.
An object that contains the value of the parameter.
- method define the types to which or from which a object can be converted. Because the conversion from to can involve truncating any fractional part of `value`, language compilers do not perform this conversion automatically. Instead, they perform the conversion only if a casting operator (in C#) or a conversion function (such as `CType` in Visual Basic) is used. Otherwise, they display a compiler error.
For languages that do not support custom operators, the alternative method is .
@@ -5426,9 +5309,9 @@ For this method matches the IEE
## Examples
The following example converts the individual elements in an array of values to objects, and then displays the result of each conversion. Note that any fractional part of a value is truncated during the conversion.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet3":::
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Explicit/Explicit1.cs" id="Snippet3":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Explicit/vb/Explicit1.vb" id="Snippet3":::
]]>
@@ -5489,20 +5372,20 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet9":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet9":::
-
- Languages that do not support custom operators can call the instance method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet10":::
-
- If `left` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet9":::
+
+ Languages that do not support custom operators can call the instance method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet10":::
+
+ If `left` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
+
The equivalent method for this operator is .]]>
@@ -5551,20 +5434,20 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet11":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet11":::
-
- Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet12":::
-
- If `right` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet11":::
+
+ Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet12":::
+
+ If `right` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
+
The equivalent method for this operator is .]]>
@@ -5617,18 +5500,18 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet20":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet20":::
-
- Languages that do not support custom operators can call the method instead. They can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet21":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet20":::
+
+ Languages that do not support custom operators can call the method instead. They can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet21":::
+
The equivalent method for this operator is .]]>
@@ -5683,18 +5566,18 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet13":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet13":::
-
- Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet14":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet13":::
+
+ Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet14":::
+
]]>
@@ -5748,18 +5631,18 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet15":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet15":::
-
- Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet16":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet15":::
+
+ Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet16":::
+
]]>
@@ -5818,20 +5701,20 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet17":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet17":::
-
- Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet18":::
-
- If `left` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet17":::
+
+ Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet18":::
+
+ If `left` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
+
The equivalent method for this operator is .]]>
@@ -5880,20 +5763,20 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet19":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet19":::
-
- Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet20":::
-
- If `right` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet19":::
+
+ Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet20":::
+
+ If `right` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
+
The equivalent method for this operator is .]]>
@@ -5946,18 +5829,18 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet22":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet22":::
-
- Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet23":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet22":::
+
+ Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet23":::
+
The equivalent method for this operator is .]]>
@@ -6012,18 +5895,18 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet21":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet21":::
-
- Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet22":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet21":::
+
+ Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet22":::
+
The equivalent method for this operator is .]]>
@@ -6078,18 +5961,18 @@ For this method matches the IEE
if is greater than ; otherwise, .
- method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
-
+ method defines the operation of the greater than or equal to operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet23":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet23":::
-
- Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet24":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet23":::
+
+ Languages that do not support custom operators can call the method instead. Some languages can also call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet24":::
+
The equivalent method for this operator is .]]>
@@ -6145,17 +6028,17 @@ For this method matches the IEE
Defines an implicit conversion of an unsigned byte to a value.
An object that contains the value of the parameter.
- .
+ For languages that do not support implicit operators, the alternative method is .
- The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet1":::
+ The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet1":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet1":::
]]>
@@ -6267,15 +6150,15 @@ For this method matches the IEE
Defines an implicit conversion of a signed 16-bit integer to a value.
An object that contains the value of the parameter.
- .
+ method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet2":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet2":::
+## Remarks
+ For languages that do not support implicit operators, the alternative method is .
+
+ The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet2":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet2":::
]]>
@@ -6321,15 +6204,15 @@ For this method matches the IEE
Defines an implicit conversion of a signed 32-bit integer to a value.
An object that contains the value of the parameter.
- .
+ method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet3":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet3":::
+## Remarks
+ For languages that do not support implicit operators, the alternative method is .
+
+ The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet3":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet3":::
]]>
@@ -6375,15 +6258,15 @@ For this method matches the IEE
Defines an implicit conversion of a signed 64-bit integer to a value.
An object that contains the value of the parameter.
- .
-
- The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet4":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet4":::
+ .
+
+ The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet4":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet4":::
]]>
@@ -6465,20 +6348,20 @@ For this method matches the IEE
The value to convert to a .
- Defines an implicit conversion of an 8-bit signed integer to a value.
-
+ Defines an implicit conversion of an 8-bit signed integer to a value.
+
This API is not CLS-compliant. The compliant alternative is .
An object that contains the value of the parameter.
- .
+ .
- The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet5":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet5":::
+ The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet5":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet5":::
]]>
@@ -6567,20 +6450,20 @@ For this method matches the IEE
The value to convert to a .
- Defines an implicit conversion of a 16-bit unsigned integer to a value.
-
+ Defines an implicit conversion of a 16-bit unsigned integer to a value.
+
This API is not CLS-compliant. The compliant alternative is .
An object that contains the value of the parameter.
- .
+ .
+
+ The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
- The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet6":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet6":::
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet6":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet6":::
]]>
@@ -6630,20 +6513,20 @@ For this method matches the IEE
The value to convert to a .
- Defines an implicit conversion of a 32-bit unsigned integer to a value.
-
+ Defines an implicit conversion of a 32-bit unsigned integer to a value.
+
This API is not CLS-compliant. The compliant alternative is .
An object that contains the value of the parameter.
- .
+ method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet7":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet7":::
+## Remarks
+ For languages that do not support implicit operators, the alternative method is .
+
+ The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet7":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet7":::
]]>
@@ -6693,20 +6576,20 @@ For this method matches the IEE
The value to convert to a .
- Defines an implicit conversion of a 64-bit unsigned integer to a value.
-
+ Defines an implicit conversion of a 64-bit unsigned integer to a value.
+
This API is not CLS-compliant. The compliant alternative is .
An object that contains the value of the parameter.
- .
+ .
+
+ The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
- The overloads of the method define the types to which or from which a compiler can automatically convert a value without an explicit casting operator (in C#) or a call to a conversion function (in Visual Basic). They are widening conversions that do not involve data loss and do not throw an . This overload lets the compiler handle conversions from a value to a value, as the following example shows.
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet8":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet8":::
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_Implicit/Implicit1.cs" id="Snippet8":::
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Implicit/vb/Implicit1.vb" id="Snippet8":::
]]>
@@ -6796,19 +6679,19 @@ For this method matches the IEE
Increments a value by 1.
The value of the parameter incremented by 1.
- method defines the increment operation for values. It enables code such as the following:
-
- :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet24":::
-
- Some languages (such as Visual Basic) that lack an increment operator or do not support operator overloading can call the method directly, as the following example shows.
-
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet25":::
-
- Because objects are immutable, the operator creates a new object whose value is one more than the object represented by `value`. Therefore, repeated calls to may be expensive.
-
+ method defines the increment operation for values. It enables code such as the following:
+
+ :::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/GreatestCommonDivisor/BigInteger_Examples.cs" id="Snippet24":::
+
+ Some languages (such as Visual Basic) that lack an increment operator or do not support operator overloading can call the method directly, as the following example shows.
+
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numeric.BigInteger.Class/vb/BigInteger_Examples.vb" id="Snippet25":::
+
+ Because objects are immutable, the operator creates a new object whose value is one more than the object represented by `value`. Therefore, repeated calls to may be expensive.
+
The equivalent method for this operator is .]]>
@@ -6867,22 +6750,22 @@ For this method matches the IEE
if and are not equal; otherwise, .
- method defines the operation of the inequality operator for values. It enables code such as the following:
-
+ method defines the operation of the inequality operator for values. It enables code such as the following:
+
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Operator1.cs" id="Snippet25":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet25":::
-
- Languages that do not support custom operators can test for inequality by using one of the following techniques:
-
-- Calling the instance method, which indicates the relationship between a and a signed long integer value.
-
-- Calling the instance method and reversing its value.
-
- If `left` is a , , , , , or value, it is implicitly converted to an value when the operation is performed.
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Operators/vb/Operator1.vb" id="Snippet25":::
+
+ Languages that do not support custom operators can test for inequality by using one of the following techniques:
+
+- Calling the instance method, which indicates the relationship between a and a signed long integer value.
+
+- Calling the