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