1 <?xml version="1.0" encoding="utf-8"?><span>
4 <name>System.Diagnostics.Contracts</name>
7 <member name="T:System.Runtime.CompilerServices.ContractHelper">
8 <summary>Provides methods that the binary rewriter uses to handle contract failures.</summary>
10 <member name="M:System.Runtime.CompilerServices.ContractHelper.RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.Exception)">
11 <summary>Used by the binary rewriter to activate the default failure behavior.</summary>
12 <param name="failureKind">One of the enumeration values that specifies the type of failure.</param>
13 <param name="userMessage">Additional user information.</param>
14 <param name="conditionText">The description of the condition that caused the failure.</param>
15 <param name="innerException">The inner exception that caused the current exception.</param>
16 <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>
17 <exception cref="T:System.ArgumentException"><paramref name="failureKind">failureKind</paramref> is not a valid <see cref="T:System.Diagnostics.Contracts.ContractFailureKind"></see> value.</exception>
19 <member name="M:System.Runtime.CompilerServices.ContractHelper.TriggerFailure(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.String,System.Exception)">
20 <summary>Triggers the default failure behavior.</summary>
21 <param name="kind">One of the enumeration values that specifies the type of failure.</param>
22 <param name="displayMessage">The message to display.</param>
23 <param name="userMessage">Additional user information.</param>
24 <param name="conditionText">The description of the condition that caused the failure.</param>
25 <param name="innerException">The inner exception that caused the current exception.</param>
27 <member name="T:System.Diagnostics.Contracts.ContractAbbreviatorAttribute">
28 <summary>Defines abbreviations that you can use in place of the full contract syntax.</summary>
30 <member name="M:System.Diagnostics.Contracts.ContractAbbreviatorAttribute.#ctor">
31 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractAbbreviatorAttribute"></see> class.</summary>
33 <member name="T:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute">
34 <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>
36 <member name="M:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute.#ctor">
37 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute"></see> class.</summary>
39 <member name="T:System.Diagnostics.Contracts.ContractClassAttribute">
40 <summary>Specifies that a separate type contains the code contracts for this type.</summary>
42 <member name="M:System.Diagnostics.Contracts.ContractClassAttribute.#ctor(System.Type)">
43 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractClassAttribute"></see> class.</summary>
44 <param name="typeContainingContracts">The type that contains the code contracts for this type.</param>
46 <member name="P:System.Diagnostics.Contracts.ContractClassAttribute.TypeContainingContracts">
47 <summary>Gets the type that contains the code contracts for this type.</summary>
48 <returns>The type that contains the code contracts for this type.</returns>
50 <member name="T:System.Diagnostics.Contracts.ContractClassForAttribute">
51 <summary>Specifies that a class is a contract for a type.</summary>
53 <member name="M:System.Diagnostics.Contracts.ContractClassForAttribute.#ctor(System.Type)">
54 <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>
55 <param name="typeContractsAreFor">The type the current class is a contract for.</param>
57 <member name="P:System.Diagnostics.Contracts.ContractClassForAttribute.TypeContractsAreFor">
58 <summary>Gets the type that this code contract applies to.</summary>
59 <returns>The type that this contract applies to.</returns>
61 <member name="T:System.Diagnostics.Contracts.ContractFailedEventArgs">
62 <summary>Provides methods and data for the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event.</summary>
64 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.#ctor(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.Exception)">
65 <summary>Provides data for the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event.</summary>
66 <param name="failureKind">One of the enumeration values that specifies the contract that failed.</param>
67 <param name="message">The message for the event.</param>
68 <param name="condition">The condition for the event.</param>
69 <param name="originalException">The exception that caused the event.</param>
71 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Condition">
72 <summary>Gets the condition for the failure of the contract.</summary>
73 <returns>The condition for the failure.</returns>
75 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.FailureKind">
76 <summary>Gets the type of contract that failed.</summary>
77 <returns>One of the enumeration values that specifies the type of contract that failed.</returns>
79 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Handled">
80 <summary>Indicates whether the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event has been handled.</summary>
81 <returns>true if the event has been handled; otherwise, false.</returns>
83 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Message">
84 <summary>Gets the message that describes the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event.</summary>
85 <returns>The message that describes the event.</returns>
87 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.OriginalException">
88 <summary>Gets the original exception that caused the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed"></see> event.</summary>
89 <returns>The exception that caused the event.</returns>
91 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.SetHandled">
92 <summary>Sets the <see cref="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Handled"></see> property to true.</summary>
94 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.SetUnwind">
95 <summary>Sets the <see cref="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Unwind"></see> property to true.</summary>
97 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Unwind">
98 <summary>Indicates whether the code contract escalation policy should be applied.</summary>
99 <returns>true to apply the escalation policy; otherwise, false. The default is false.</returns>
101 <member name="T:System.Diagnostics.Contracts.ContractFailureKind">
102 <summary>Specifies the type of contract that failed.</summary>
104 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Assert">
105 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Assert"></see> contract failed.</summary>
108 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Assume">
109 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Assume"></see> contract failed.</summary>
112 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Invariant">
113 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Invariant"></see> contract failed.</summary>
116 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Postcondition">
117 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Ensures"></see> contract failed.</summary>
120 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.PostconditionOnException">
121 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.EnsuresOnThrow"></see> contract failed.</summary>
124 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Precondition">
125 <summary>A <see cref="Overload:System.Diagnostics.Contracts.Contract.Requires"></see> contract failed.</summary>
128 <member name="T:System.Diagnostics.Contracts.ContractInvariantMethodAttribute">
129 <summary>Marks a method as being the invariant method for a class.</summary>
131 <member name="M:System.Diagnostics.Contracts.ContractInvariantMethodAttribute.#ctor">
132 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractInvariantMethodAttribute"></see> class.</summary>
134 <member name="T:System.Diagnostics.Contracts.ContractOptionAttribute">
135 <summary>Enables you to set contract and tool options at assembly, type, or method granularity.</summary>
137 <member name="M:System.Diagnostics.Contracts.ContractOptionAttribute.#ctor(System.String,System.String,System.Boolean)">
138 <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>
139 <param name="category">The category for the option to be set.</param>
140 <param name="setting">The option setting.</param>
141 <param name="enabled">true to enable the option; false to disable the option.</param>
143 <member name="M:System.Diagnostics.Contracts.ContractOptionAttribute.#ctor(System.String,System.String,System.String)">
144 <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>
145 <param name="category">The category of the option to be set.</param>
146 <param name="setting">The option setting.</param>
147 <param name="value">The value for the setting.</param>
149 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Category">
150 <summary>Gets the category of the option.</summary>
151 <returns>The category of the option.</returns>
153 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Enabled">
154 <summary>Determines if an option is enabled.</summary>
155 <returns>true if the option is enabled; otherwise, false.</returns>
157 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Setting">
158 <summary>Gets the setting for the option.</summary>
159 <returns>The setting for the option.</returns>
161 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Value">
162 <summary>Gets the value for the option.</summary>
163 <returns>The value for the option.</returns>
165 <member name="T:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute">
166 <summary>Specifies that a field can be used in method contracts when the field has less visibility than the method.</summary>
168 <member name="M:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute.#ctor(System.String)">
169 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute"></see> class.</summary>
170 <param name="name">The property name to apply to the field.</param>
172 <member name="P:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute.Name">
173 <summary>Gets the property name to be applied to the field.</summary>
174 <returns>The property name to be applied to the field.</returns>
176 <member name="T:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute">
177 <summary>Specifies that an assembly is a reference assembly that contains contracts.</summary>
179 <member name="M:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute.#ctor">
180 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute"></see> class.</summary>
182 <member name="T:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute">
183 <summary>Identifies a member that has no run-time behavior.</summary>
185 <member name="M:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute.#ctor">
186 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute"></see> class.</summary>
188 <member name="T:System.Diagnostics.Contracts.ContractVerificationAttribute">
189 <summary>Instructs analysis tools to assume the correctness of an assembly, type, or member without performing static verification.</summary>
191 <member name="M:System.Diagnostics.Contracts.ContractVerificationAttribute.#ctor(System.Boolean)">
192 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractVerificationAttribute"></see> class.</summary>
193 <param name="value">true to require verification; otherwise, false.</param>
195 <member name="P:System.Diagnostics.Contracts.ContractVerificationAttribute.Value">
196 <summary>Gets the value that indicates whether to verify the contract of the target.</summary>
197 <returns>true if verification is required; otherwise, false.</returns>
199 <member name="T:System.Diagnostics.Contracts.PureAttribute">
200 <summary>Indicates that a type or method is pure, that is, it does not make any visible state changes.</summary>
202 <member name="M:System.Diagnostics.Contracts.PureAttribute.#ctor">
203 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.PureAttribute"></see> class.</summary>
205 <member name="T:System.Diagnostics.Contracts.Contract">
206 <summary>Contains static methods for representing program contracts such as preconditions, postconditions, and object invariants.</summary>
208 <member name="M:System.Diagnostics.Contracts.Contract.Assert(System.Boolean)">
209 <summary>Checks for a condition; if the condition is false, follows the escalation policy set for the analyzer.</summary>
210 <param name="condition">The conditional expression to test.</param>
212 <member name="M:System.Diagnostics.Contracts.Contract.Assert(System.Boolean,System.String)">
213 <summary>Checks for a condition; if the condition is false, follows the escalation policy set by the analyzer and displays the specified message.</summary>
214 <param name="condition">The conditional expression to test.</param>
215 <param name="userMessage">A message to display if the condition is not met.</param>
217 <member name="M:System.Diagnostics.Contracts.Contract.Assume(System.Boolean)">
218 <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>
219 <param name="condition">The conditional expression to assume true.</param>
221 <member name="M:System.Diagnostics.Contracts.Contract.Assume(System.Boolean,System.String)">
222 <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>
223 <param name="condition">The conditional expression to assume true.</param>
224 <param name="userMessage">The message to post if the assumption fails.</param>
226 <member name="E:System.Diagnostics.Contracts.Contract.ContractFailed">
227 <summary>Occurs when a contract fails.</summary>
230 <member name="M:System.Diagnostics.Contracts.Contract.EndContractBlock">
231 <summary>Marks the end of the contract section when a method's contracts contain only preconditions in the if-then-throw form.</summary>
233 <member name="M:System.Diagnostics.Contracts.Contract.Ensures(System.Boolean)">
234 <summary>Specifies a postcondition contract for the enclosing method or property.</summary>
235 <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>
237 <member name="M:System.Diagnostics.Contracts.Contract.Ensures(System.Boolean,System.String)">
238 <summary>Specifies a postcondition contract for a provided exit condition and a message to display if the condition is false.</summary>
239 <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>
240 <param name="userMessage">The message to display if the expression is not true.</param>
242 <member name="M:System.Diagnostics.Contracts.Contract.EnsuresOnThrow``1(System.Boolean)">
243 <summary>Specifies a postcondition contract for the enclosing method or property, based on the provided exception and condition.</summary>
244 <param name="condition">The conditional expression to test.</param>
245 <typeparam name="TException">The type of exception that invokes the postcondition check.</typeparam>
247 <member name="M:System.Diagnostics.Contracts.Contract.EnsuresOnThrow``1(System.Boolean,System.String)">
248 <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>
249 <param name="condition">The conditional expression to test.</param>
250 <param name="userMessage">The message to display if the expression is false.</param>
251 <typeparam name="TException">The type of exception that invokes the postcondition check.</typeparam>
253 <member name="M:System.Diagnostics.Contracts.Contract.Exists(System.Int32,System.Int32,System.Predicate{System.Int32})">
254 <summary>Determines whether a specified test is true for any integer within a range of integers.</summary>
255 <param name="fromInclusive">The first integer to pass to predicate.</param>
256 <param name="toExclusive">One more than the last integer to pass to predicate.</param>
257 <param name="predicate">The function to evaluate for any value of the integer in the specified range.</param>
258 <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>
259 <exception cref="T:System.ArgumentNullException"><paramref name="predicate">predicate</paramref> is null.</exception>
260 <exception cref="T:System.ArgumentException"><paramref name="toExclusive">toExclusive</paramref> is less than <paramref name="fromInclusive">fromInclusive</paramref>.</exception>
262 <member name="M:System.Diagnostics.Contracts.Contract.Exists``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0})">
263 <summary>Determines whether an element within a collection of elements exists within a function.</summary>
264 <param name="collection">The collection from which elements of type T will be drawn to pass to predicate.</param>
265 <param name="predicate">The function to evaluate for an element in collection.</param>
266 <typeparam name="T">The type that is contained in collection.</typeparam>
267 <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>
268 <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> or <paramref name="predicate">predicate</paramref> is null.</exception>
270 <member name="M:System.Diagnostics.Contracts.Contract.ForAll(System.Int32,System.Int32,System.Predicate{System.Int32})">
271 <summary>Determines whether a particular condition is valid for all integers in a specified range.</summary>
272 <param name="fromInclusive">The first integer to pass to predicate.</param>
273 <param name="toExclusive">One more than the last integer to pass to predicate.</param>
274 <param name="predicate">The function to evaluate for the existence of the integers in the specified range.</param>
275 <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>
276 <exception cref="T:System.ArgumentNullException"><paramref name="predicate">predicate</paramref> is null.</exception>
277 <exception cref="T:System.ArgumentException"><paramref name="toExclusive">toExclusive</paramref> is less than <paramref name="fromInclusive">fromInclusive</paramref>.</exception>
279 <member name="M:System.Diagnostics.Contracts.Contract.ForAll``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0})">
280 <summary>Determines whether all the elements in a collection exist within a function.</summary>
281 <param name="collection">The collection from which elements of type T will be drawn to pass to predicate.</param>
282 <param name="predicate">The function to evaluate for the existence of all the elements in collection.</param>
283 <typeparam name="T">The type that is contained in collection.</typeparam>
284 <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>
285 <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> or <paramref name="predicate">predicate</paramref> is null.</exception>
287 <member name="M:System.Diagnostics.Contracts.Contract.Invariant(System.Boolean)">
288 <summary>Specifies an invariant contract for the enclosing method or property.</summary>
289 <param name="condition">The conditional expression to test.</param>
291 <member name="M:System.Diagnostics.Contracts.Contract.Invariant(System.Boolean,System.String)">
292 <summary>Specifies an invariant contract for the enclosing method or property, and displays a message if the condition for the contract fails.</summary>
293 <param name="condition">The conditional expression to test.</param>
294 <param name="userMessage">The message to display if the condition is false.</param>
296 <member name="M:System.Diagnostics.Contracts.Contract.OldValue``1(``0)">
297 <summary>Represents values as they were at the start of a method or property.</summary>
298 <param name="value">The value to represent (field or parameter).</param>
299 <typeparam name="T">The type of value.</typeparam>
300 <returns>The value of the parameter or field at the start of a method or property.</returns>
302 <member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean)">
303 <summary>Specifies a precondition contract for the enclosing method or property.</summary>
304 <param name="condition">The conditional expression to test.</param>
306 <member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean,System.String)">
307 <summary>Specifies a precondition contract for the enclosing method or property, and displays a message if the condition for the contract fails.</summary>
308 <param name="condition">The conditional expression to test.</param>
309 <param name="userMessage">The message to display if the condition is false.</param>
311 <member name="M:System.Diagnostics.Contracts.Contract.Requires``1(System.Boolean)">
312 <summary>Specifies a precondition contract for the enclosing method or property, and throws an exception if the condition for the contract fails.</summary>
313 <param name="condition">The conditional expression to test.</param>
314 <typeparam name="TException">The exception to throw if the condition is false.</typeparam>
316 <member name="M:System.Diagnostics.Contracts.Contract.Requires``1(System.Boolean,System.String)">
317 <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>
318 <param name="condition">The conditional expression to test.</param>
319 <param name="userMessage">The message to display if the condition is false.</param>
320 <typeparam name="TException">The exception to throw if the condition is false.</typeparam>
322 <member name="M:System.Diagnostics.Contracts.Contract.Result``1">
323 <summary>Represents the return value of a method or property.</summary>
324 <typeparam name="T">Type of return value of the enclosing method or property.</typeparam>
325 <returns>Return value of the enclosing method or property.</returns>
327 <member name="M:System.Diagnostics.Contracts.Contract.ValueAtReturn``1(``0@)">
328 <summary>Represents the final (output) value of an out parameter when returning from a method.</summary>
329 <param name="value">The out parameter.</param>
330 <typeparam name="T">The type of the out parameter.</typeparam>
331 <returns>The output value of the out parameter.</returns>