1 <?xml version="1.0" encoding="utf-8"?><doc>
3 <name>System.Diagnostics.Contracts</name>
6 <member name="T:System.Diagnostics.Contracts.PureAttribute">
7 <summary>Indicates that a type or method is pure, that is, it does not make any visible state changes.</summary>
9 <member name="M:System.Diagnostics.Contracts.PureAttribute.#ctor">
10 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.PureAttribute"></see> class.</summary>
12 <member name="T:System.Diagnostics.Contracts.ContractVerificationAttribute">
13 <summary>Instructs analysis tools to assume the correctness of an assembly, type, or member without performing static verification.</summary>
15 <member name="M:System.Diagnostics.Contracts.ContractVerificationAttribute.#ctor(System.Boolean)">
16 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractVerificationAttribute"></see> class.</summary>
17 <param name="value"><see langword="true"></see> to require verification; otherwise, <see langword="false"></see>.</param>
19 <member name="P:System.Diagnostics.Contracts.ContractVerificationAttribute.Value">
20 <summary>Gets the value that indicates whether to verify the contract of the target.</summary>
21 <returns><see langword="true"></see> if verification is required; otherwise, <see langword="false"></see>.</returns>
23 <member name="T:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute">
24 <summary>Identifies a member that has no run-time behavior.</summary>
26 <member name="M:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute.#ctor">
27 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute"></see> class.</summary>
29 <member name="T:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute">
30 <summary>Specifies that an assembly is a reference assembly that contains contracts.</summary>
32 <member name="M:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute.#ctor">
33 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute"></see> class.</summary>
35 <member name="T:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute">
36 <summary>Specifies that a field can be used in method contracts when the field has less visibility than the method.</summary>
38 <member name="M:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute.#ctor(System.String)">
39 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute"></see> class.</summary>
40 <param name="name">The property name to apply to the field.</param>
42 <member name="P:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute.Name">
43 <summary>Gets the property name to be applied to the field.</summary>
44 <returns>The property name to be applied to the field.</returns>
46 <member name="T:System.Diagnostics.Contracts.ContractOptionAttribute">
47 <summary>Enables you to set contract and tool options at assembly, type, or method granularity.</summary>
49 <member name="M:System.Diagnostics.Contracts.ContractOptionAttribute.#ctor(System.String,System.String,System.Boolean)">
50 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractOptionAttribute"></see> class by using the provided category, setting, and enable/disable value.</summary>
51 <param name="category">The category for the option to be set.</param>
52 <param name="setting">The option setting.</param>
53 <param name="enabled"><see langword="true"></see> to enable the option; <see langword="false"></see> to disable the option.</param>
55 <member name="M:System.Diagnostics.Contracts.ContractOptionAttribute.#ctor(System.String,System.String,System.String)">
56 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractOptionAttribute"></see> class by using the provided category, setting, and value.</summary>
57 <param name="category">The category of the option to be set.</param>
58 <param name="setting">The option setting.</param>
59 <param name="value">The value for the setting.</param>
61 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Category">
62 <summary>Gets the category of the option.</summary>
63 <returns>The category of the option.</returns>
65 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Enabled">
66 <summary>Determines if an option is enabled.</summary>
67 <returns><see langword="true"></see> if the option is enabled; otherwise, <see langword="false"></see>.</returns>
69 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Setting">
70 <summary>Gets the setting for the option.</summary>
71 <returns>The setting for the option.</returns>
73 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Value">
74 <summary>Gets the value for the option.</summary>
75 <returns>The value for the option.</returns>
77 <member name="T:System.Diagnostics.Contracts.ContractInvariantMethodAttribute">
78 <summary>Marks a method as being the invariant method for a class.</summary>
80 <member name="M:System.Diagnostics.Contracts.ContractInvariantMethodAttribute.#ctor">
81 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractInvariantMethodAttribute"></see> class.</summary>
83 <member name="T:System.Diagnostics.Contracts.ContractFailureKind">
84 <summary>Specifies the type of contract that failed.</summary>
86 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Assert">
87 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Assert"></see> contract failed.</summary>
90 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Assume">
91 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Assume"></see> contract failed.</summary>
94 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Invariant">
95 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Invariant"></see> contract failed.</summary>
98 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Postcondition">
99 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Ensures"></see> contract failed.</summary>
102 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.PostconditionOnException">
103 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.EnsuresOnThrow"></see> contract failed.</summary>
106 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Precondition">
107 <summary>A <see cref="Overload:System.Diagnostics.Contracts.Contract.Requires"></see> contract failed.</summary>
110 <member name="T:System.Diagnostics.Contracts.ContractFailedEventArgs">
111 <summary>Provides methods and data for the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event.</summary>
113 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.#ctor(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.Exception)">
114 <summary>Provides data for the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event.</summary>
115 <param name="failureKind">One of the enumeration values that specifies the contract that failed.</param>
116 <param name="message">The message for the event.</param>
117 <param name="condition">The condition for the event.</param>
118 <param name="originalException">The exception that caused the event.</param>
120 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Condition">
121 <summary>Gets the condition for the failure of the contract.</summary>
122 <returns>The condition for the failure.</returns>
124 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.FailureKind">
125 <summary>Gets the type of contract that failed.</summary>
126 <returns>One of the enumeration values that specifies the type of contract that failed.</returns>
128 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Handled">
129 <summary>Indicates whether the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event has been handled.</summary>
130 <returns><see langword="true"></see> if the event has been handled; otherwise, <see langword="false"></see>.</returns>
132 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Message">
133 <summary>Gets the message that describes the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event.</summary>
134 <returns>The message that describes the event.</returns>
136 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.OriginalException">
137 <summary>Gets the original exception that caused the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event.</summary>
138 <returns>The exception that caused the event.</returns>
140 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.SetHandled">
141 <summary>Sets the <see cref="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Handled"></see> property to <see langword="true"></see>.</summary>
143 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.SetUnwind">
144 <summary>Sets the <see cref="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Unwind"></see> property to <see langword="true"></see>.</summary>
146 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Unwind">
147 <summary>Indicates whether the code contract escalation policy should be applied.</summary>
148 <returns><see langword="true"></see> to apply the escalation policy; otherwise, <see langword="false"></see>. The default is <see langword="false"></see>.</returns>
150 <member name="T:System.Diagnostics.Contracts.ContractClassForAttribute">
151 <summary>Specifies that a class is a contract for a type.</summary>
153 <member name="M:System.Diagnostics.Contracts.ContractClassForAttribute.#ctor(System.Type)">
154 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractClassForAttribute"></see> class, specifying the type the current class is a contract for.</summary>
155 <param name="typeContractsAreFor">The type the current class is a contract for.</param>
157 <member name="P:System.Diagnostics.Contracts.ContractClassForAttribute.TypeContractsAreFor">
158 <summary>Gets the type that this code contract applies to.</summary>
159 <returns>The type that this contract applies to.</returns>
161 <member name="T:System.Diagnostics.Contracts.ContractClassAttribute">
162 <summary>Specifies that a separate type contains the code contracts for this type.</summary>
164 <member name="M:System.Diagnostics.Contracts.ContractClassAttribute.#ctor(System.Type)">
165 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractClassAttribute"></see> class.</summary>
166 <param name="typeContainingContracts">The type that contains the code contracts for this type.</param>
168 <member name="P:System.Diagnostics.Contracts.ContractClassAttribute.TypeContainingContracts">
169 <summary>Gets the type that contains the code contracts for this type.</summary>
170 <returns>The type that contains the code contracts for this type.</returns>
172 <member name="T:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute">
173 <summary>Enables the factoring of legacy <see langword="if-then-throw"></see> code into separate methods for reuse, and provides full control over thrown exceptions and arguments.</summary>
175 <member name="M:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute.#ctor">
176 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute"></see> class.</summary>
178 <member name="T:System.Diagnostics.Contracts.ContractAbbreviatorAttribute">
179 <summary>Defines abbreviations that you can use in place of the full contract syntax.</summary>
181 <member name="M:System.Diagnostics.Contracts.ContractAbbreviatorAttribute.#ctor">
182 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractAbbreviatorAttribute"></see> class.</summary>
184 <member name="T:System.Diagnostics.Contracts.Contract">
185 <summary>Contains static methods for representing program contracts such as preconditions, postconditions, and object invariants.</summary>
187 <member name="M:System.Diagnostics.Contracts.Contract.Assert(System.Boolean)">
188 <summary>Checks for a condition; if the condition is <see langword="false"></see>, follows the escalation policy set for the analyzer.</summary>
189 <param name="condition">The conditional expression to test.</param>
191 <member name="M:System.Diagnostics.Contracts.Contract.Assert(System.Boolean,System.String)">
192 <summary>Checks for a condition; if the condition is <see langword="false"></see>, follows the escalation policy set by the analyzer and displays the specified message.</summary>
193 <param name="condition">The conditional expression to test.</param>
194 <param name="userMessage">A message to display if the condition is not met.</param>
196 <member name="M:System.Diagnostics.Contracts.Contract.Assume(System.Boolean)">
197 <summary>Instructs code analysis tools to assume that the specified condition is <see langword="true"></see>, even if it cannot be statically proven to always be <see langword="true"></see>.</summary>
198 <param name="condition">The conditional expression to assume <see langword="true"></see>.</param>
200 <member name="M:System.Diagnostics.Contracts.Contract.Assume(System.Boolean,System.String)">
201 <summary>Instructs code analysis tools to assume that a condition is <see langword="true"></see>, even if it cannot be statically proven to always be <see langword="true"></see>, and displays a message if the assumption fails.</summary>
202 <param name="condition">The conditional expression to assume <see langword="true"></see>.</param>
203 <param name="userMessage">The message to post if the assumption fails.</param>
205 <member name="E:System.Diagnostics.Contracts.Contract.ContractFailed">
206 <summary>Occurs when a contract fails.</summary>
208 <member name="M:System.Diagnostics.Contracts.Contract.EndContractBlock">
209 <summary>Marks the end of the contract section when a method&#39;s contracts contain only preconditions in the <see langword="if"></see>-<see langword="then"></see>-<see langword="throw"></see> form.</summary>
211 <member name="M:System.Diagnostics.Contracts.Contract.Ensures(System.Boolean)">
212 <summary>Specifies a postcondition contract for the enclosing method or property.</summary>
213 <param name="condition">The conditional expression to test. The expression may include <see cref="M:System.Diagnostics.Contracts.Contract.OldValue``1(``0)"></see>, <see cref="M:System.Diagnostics.Contracts.Contract.ValueAtReturn``1(``0@)"></see>, and <see cref="M:System.Diagnostics.Contracts.Contract.Result``1"></see> values.</param>
215 <member name="M:System.Diagnostics.Contracts.Contract.Ensures(System.Boolean,System.String)">
216 <summary>Specifies a postcondition contract for a provided exit condition and a message to display if the condition is <see langword="false"></see>.</summary>
217 <param name="condition">The conditional expression to test. The expression may include <see cref="M:System.Diagnostics.Contracts.Contract.OldValue``1(``0)"></see> and <see cref="M:System.Diagnostics.Contracts.Contract.Result``1"></see> values.</param>
218 <param name="userMessage">The message to display if the expression is not <see langword="true"></see>.</param>
220 <member name="M:System.Diagnostics.Contracts.Contract.EnsuresOnThrow``1(System.Boolean)">
221 <summary>Specifies a postcondition contract for the enclosing method or property, based on the provided exception and condition.</summary>
222 <param name="condition">The conditional expression to test.</param>
223 <typeparam name="TException">The type of exception that invokes the postcondition check.</typeparam>
225 <member name="M:System.Diagnostics.Contracts.Contract.EnsuresOnThrow``1(System.Boolean,System.String)">
226 <summary>Specifies a postcondition contract and a message to display if the condition is <see langword="false"></see> for the enclosing method or property, based on the provided exception and condition.</summary>
227 <param name="condition">The conditional expression to test.</param>
228 <param name="userMessage">The message to display if the expression is <see langword="false"></see>.</param>
229 <typeparam name="TException">The type of exception that invokes the postcondition check.</typeparam>
231 <member name="M:System.Diagnostics.Contracts.Contract.Exists(System.Int32,System.Int32,System.Predicate{System.Int32})">
232 <summary>Determines whether a specified test is true for any integer within a range of integers.</summary>
233 <param name="fromInclusive">The first integer to pass to predicate.</param>
234 <param name="toExclusive">One more than the last integer to pass to predicate.</param>
235 <param name="predicate">The function to evaluate for any value of the integer in the specified range.</param>
236 <returns><see langword="true"></see> if <paramref name="predicate">predicate</paramref> returns <see langword="true"></see> for any integer starting from <paramref name="fromInclusive">fromInclusive</paramref> to <paramref name="toExclusive">toExclusive</paramref> - 1.</returns>
237 <exception cref="T:System.ArgumentNullException"><paramref name="predicate">predicate</paramref> is <see langword="null"></see>.</exception>
238 <exception cref="T:System.ArgumentException"><paramref name="toExclusive">toExclusive</paramref> is less than <paramref name="fromInclusive">fromInclusive</paramref>.</exception>
240 <member name="M:System.Diagnostics.Contracts.Contract.Exists``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0})">
241 <summary>Determines whether an element within a collection of elements exists within a function.</summary>
242 <param name="collection">The collection from which elements of type T will be drawn to pass to predicate.</param>
243 <param name="predicate">The function to evaluate for an element in collection.</param>
244 <typeparam name="T">The type that is contained in collection.</typeparam>
245 <returns><see langword="true"></see> if and only if <paramref name="predicate">predicate</paramref> returns <see langword="true"></see> for any element of type <paramref name="T">T</paramref> in <paramref name="collection">collection</paramref>.</returns>
246 <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> or <paramref name="predicate">predicate</paramref> is <see langword="null"></see>.</exception>
248 <member name="M:System.Diagnostics.Contracts.Contract.ForAll(System.Int32,System.Int32,System.Predicate{System.Int32})">
249 <summary>Determines whether a particular condition is valid for all integers in a specified range.</summary>
250 <param name="fromInclusive">The first integer to pass to predicate.</param>
251 <param name="toExclusive">One more than the last integer to pass to predicate.</param>
252 <param name="predicate">The function to evaluate for the existence of the integers in the specified range.</param>
253 <returns><see langword="true"></see> if <paramref name="predicate">predicate</paramref> returns <see langword="true"></see> for all integers starting from <paramref name="fromInclusive">fromInclusive</paramref> to <paramref name="toExclusive">toExclusive</paramref> - 1.</returns>
254 <exception cref="T:System.ArgumentNullException"><paramref name="predicate">predicate</paramref> is <see langword="null"></see>.</exception>
255 <exception cref="T:System.ArgumentException"><paramref name="toExclusive">toExclusive</paramref> is less than <paramref name="fromInclusive">fromInclusive</paramref>.</exception>
257 <member name="M:System.Diagnostics.Contracts.Contract.ForAll``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0})">
258 <summary>Determines whether all the elements in a collection exist within a function.</summary>
259 <param name="collection">The collection from which elements of type T will be drawn to pass to predicate.</param>
260 <param name="predicate">The function to evaluate for the existence of all the elements in collection.</param>
261 <typeparam name="T">The type that is contained in collection.</typeparam>
262 <returns><see langword="true"></see> if and only if <paramref name="predicate">predicate</paramref> returns <see langword="true"></see> for all elements of type <paramref name="T">T</paramref> in <paramref name="collection">collection</paramref>.</returns>
263 <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> or <paramref name="predicate">predicate</paramref> is <see langword="null"></see>.</exception>
265 <member name="M:System.Diagnostics.Contracts.Contract.Invariant(System.Boolean)">
266 <summary>Specifies an invariant contract for the enclosing method or property.</summary>
267 <param name="condition">The conditional expression to test.</param>
269 <member name="M:System.Diagnostics.Contracts.Contract.Invariant(System.Boolean,System.String)">
270 <summary>Specifies an invariant contract for the enclosing method or property, and displays a message if the condition for the contract fails.</summary>
271 <param name="condition">The conditional expression to test.</param>
272 <param name="userMessage">The message to display if the condition is <see langword="false"></see>.</param>
274 <member name="M:System.Diagnostics.Contracts.Contract.OldValue``1(``0)">
275 <summary>Represents values as they were at the start of a method or property.</summary>
276 <param name="value">The value to represent (field or parameter).</param>
277 <typeparam name="T">The type of value.</typeparam>
278 <returns>The value of the parameter or field at the start of a method or property.</returns>
280 <member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean)">
281 <summary>Specifies a precondition contract for the enclosing method or property.</summary>
282 <param name="condition">The conditional expression to test.</param>
284 <member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean,System.String)">
285 <summary>Specifies a precondition contract for the enclosing method or property, and displays a message if the condition for the contract fails.</summary>
286 <param name="condition">The conditional expression to test.</param>
287 <param name="userMessage">The message to display if the condition is <see langword="false"></see>.</param>
289 <member name="M:System.Diagnostics.Contracts.Contract.Requires``1(System.Boolean)">
290 <summary>Specifies a precondition contract for the enclosing method or property, and throws an exception if the condition for the contract fails.</summary>
291 <param name="condition">The conditional expression to test.</param>
292 <typeparam name="TException">The exception to throw if the condition is <see langword="false"></see>.</typeparam>
294 <member name="M:System.Diagnostics.Contracts.Contract.Requires``1(System.Boolean,System.String)">
295 <summary>Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.</summary>
296 <param name="condition">The conditional expression to test.</param>
297 <param name="userMessage">The message to display if the condition is <see langword="false"></see>.</param>
298 <typeparam name="TException">The exception to throw if the condition is <see langword="false"></see>.</typeparam>
300 <member name="M:System.Diagnostics.Contracts.Contract.Result``1">
301 <summary>Represents the return value of a method or property.</summary>
302 <typeparam name="T">Type of return value of the enclosing method or property.</typeparam>
303 <returns>Return value of the enclosing method or property.</returns>
305 <member name="M:System.Diagnostics.Contracts.Contract.ValueAtReturn``1(``0@)">
306 <summary>Represents the final (output) value of an <see langword="out"></see> parameter when returning from a method.</summary>
307 <param name="value">The <see langword="out"></see> parameter.</param>
308 <typeparam name="T">The type of the <see langword="out"></see> parameter.</typeparam>
309 <returns>The output value of the <see langword="out"></see> parameter.</returns>
311 <member name="T:System.Runtime.CompilerServices.ContractHelper">
312 <summary>Provides methods that the binary rewriter uses to handle contract failures.</summary>
314 <member name="M:System.Runtime.CompilerServices.ContractHelper.RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.Exception)">
315 <summary>Used by the binary rewriter to activate the default failure behavior.</summary>
316 <param name="failureKind">One of the enumeration values that specifies the type of failure.</param>
317 <param name="userMessage">Additional user information.</param>
318 <param name="conditionText">The description of the condition that caused the failure.</param>
319 <param name="innerException">The inner exception that caused the current exception.</param>
320 <returns>A null reference (<see langword="Nothing"></see> in Visual Basic) if the event was handled and should not trigger a failure; otherwise, returns the localized failure message.</returns>
321 <exception cref="T:System.ArgumentException"><paramref name="failureKind">failureKind</paramref> is not a valid <see cref="System.Diagnostics.Contracts.ContractFailureKind"></see> value.</exception>
323 <member name="M:System.Runtime.CompilerServices.ContractHelper.TriggerFailure(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.String,System.Exception)">
324 <summary>Triggers the default failure behavior.</summary>
325 <param name="kind">One of the enumeration values that specifies the type of failure.</param>
326 <param name="displayMessage">The message to display.</param>
327 <param name="userMessage">Additional user information.</param>
328 <param name="conditionText">The description of the condition that caused the failure.</param>
329 <param name="innerException">The inner exception that caused the current exception.</param>