1 <?xml version="1.0" encoding="utf-8"?>
4 <name>System.Diagnostics.Contracts</name>
7 <member name="T:System.Diagnostics.Contracts.Contract">
8 <summary>Contains static methods for representing program contracts such as preconditions, postconditions, and object invariants.</summary>
10 <member name="M:System.Diagnostics.Contracts.Contract.Assert(System.Boolean)">
11 <summary>Checks for a condition; if the condition is <see langword="false" />, follows the escalation policy set for the analyzer.</summary>
12 <param name="condition">The conditional expression to test.</param>
14 <member name="M:System.Diagnostics.Contracts.Contract.Assert(System.Boolean,System.String)">
15 <summary>Checks for a condition; if the condition is <see langword="false" />, follows the escalation policy set by the analyzer and displays the specified message.</summary>
16 <param name="condition">The conditional expression to test.</param>
17 <param name="userMessage">A message to display if the condition is not met.</param>
19 <member name="M:System.Diagnostics.Contracts.Contract.Assume(System.Boolean)">
20 <summary>Instructs code analysis tools to assume that the specified condition is <see langword="true" />, even if it cannot be statically proven to always be <see langword="true" />.</summary>
21 <param name="condition">The conditional expression to assume <see langword="true" />.</param>
23 <member name="M:System.Diagnostics.Contracts.Contract.Assume(System.Boolean,System.String)">
24 <summary>Instructs code analysis tools to assume that a condition is <see langword="true" />, even if it cannot be statically proven to always be <see langword="true" />, and displays a message if the assumption fails.</summary>
25 <param name="condition">The conditional expression to assume <see langword="true" />.</param>
26 <param name="userMessage">The message to post if the assumption fails.</param>
28 <member name="E:System.Diagnostics.Contracts.Contract.ContractFailed">
29 <summary>Occurs when a contract fails.</summary>
31 <member name="M:System.Diagnostics.Contracts.Contract.EndContractBlock">
32 <summary>Marks the end of the contract section when a method's contracts contain only preconditions in the <see langword="if" />-<see langword="then" />-<see langword="throw" /> form.</summary>
34 <member name="M:System.Diagnostics.Contracts.Contract.Ensures(System.Boolean)">
35 <summary>Specifies a postcondition contract for the enclosing method or property.</summary>
36 <param name="condition">The conditional expression to test. The expression may include <see cref="M:System.Diagnostics.Contracts.Contract.OldValue``1(``0)" />, <see cref="M:System.Diagnostics.Contracts.Contract.ValueAtReturn``1(``0@)" />, and <see cref="M:System.Diagnostics.Contracts.Contract.Result``1" /> values.</param>
38 <member name="M:System.Diagnostics.Contracts.Contract.Ensures(System.Boolean,System.String)">
39 <summary>Specifies a postcondition contract for a provided exit condition and a message to display if the condition is <see langword="false" />.</summary>
40 <param name="condition">The conditional expression to test. The expression may include <see cref="M:System.Diagnostics.Contracts.Contract.OldValue``1(``0)" /> and <see cref="M:System.Diagnostics.Contracts.Contract.Result``1" /> values.</param>
41 <param name="userMessage">The message to display if the expression is not <see langword="true" />.</param>
43 <member name="M:System.Diagnostics.Contracts.Contract.EnsuresOnThrow``1(System.Boolean)">
44 <summary>Specifies a postcondition contract for the enclosing method or property, based on the provided exception and condition.</summary>
45 <param name="condition">The conditional expression to test.</param>
46 <typeparam name="TException">The type of exception that invokes the postcondition check.</typeparam>
48 <member name="M:System.Diagnostics.Contracts.Contract.EnsuresOnThrow``1(System.Boolean,System.String)">
49 <summary>Specifies a postcondition contract and a message to display if the condition is <see langword="false" /> for the enclosing method or property, based on the provided exception and condition.</summary>
50 <param name="condition">The conditional expression to test.</param>
51 <param name="userMessage">The message to display if the expression is <see langword="false" />.</param>
52 <typeparam name="TException">The type of exception that invokes the postcondition check.</typeparam>
54 <member name="M:System.Diagnostics.Contracts.Contract.Exists(System.Int32,System.Int32,System.Predicate{System.Int32})">
55 <summary>Determines whether a specified test is true for any integer within a range of integers.</summary>
56 <param name="fromInclusive">The first integer to pass to <paramref name="predicate" />.</param>
57 <param name="toExclusive">One more than the last integer to pass to <paramref name="predicate" />.</param>
58 <param name="predicate">The function to evaluate for any value of the integer in the specified range.</param>
60 <see langword="true" /> if <paramref name="predicate" /> returns <see langword="true" /> for any integer starting from <paramref name="fromInclusive" /> to <paramref name="toExclusive" /> - 1.</returns>
61 <exception cref="T:System.ArgumentNullException">
62 <paramref name="predicate" /> is <see langword="null" />.</exception>
63 <exception cref="T:System.ArgumentException">
64 <paramref name="toExclusive" /> is less than <paramref name="fromInclusive" />.</exception>
66 <member name="M:System.Diagnostics.Contracts.Contract.Exists``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0})">
67 <summary>Determines whether an element within a collection of elements exists within a function.</summary>
68 <param name="collection">The collection from which elements of type <c>T</c> will be drawn to pass to <paramref name="predicate" />.</param>
69 <param name="predicate">The function to evaluate for an element in <paramref name="collection" />.</param>
70 <typeparam name="T">The type that is contained in <paramref name="collection" />.</typeparam>
72 <see langword="true" /> if and only if <paramref name="predicate" /> returns <see langword="true" /> for any element of type <paramref name="T" /> in <paramref name="collection" />.</returns>
73 <exception cref="T:System.ArgumentNullException">
74 <paramref name="collection" /> or <paramref name="predicate" /> is <see langword="null" />.</exception>
76 <member name="M:System.Diagnostics.Contracts.Contract.ForAll(System.Int32,System.Int32,System.Predicate{System.Int32})">
77 <summary>Determines whether a particular condition is valid for all integers in a specified range.</summary>
78 <param name="fromInclusive">The first integer to pass to <paramref name="predicate" />.</param>
79 <param name="toExclusive">One more than the last integer to pass to <paramref name="predicate" />.</param>
80 <param name="predicate">The function to evaluate for the existence of the integers in the specified range.</param>
82 <see langword="true" /> if <paramref name="predicate" /> returns <see langword="true" /> for all integers starting from <paramref name="fromInclusive" /> to <paramref name="toExclusive" /> - 1.</returns>
83 <exception cref="T:System.ArgumentNullException">
84 <paramref name="predicate" /> is <see langword="null" />.</exception>
85 <exception cref="T:System.ArgumentException">
86 <paramref name="toExclusive" /> is less than <paramref name="fromInclusive" />.</exception>
88 <member name="M:System.Diagnostics.Contracts.Contract.ForAll``1(System.Collections.Generic.IEnumerable{``0},System.Predicate{``0})">
89 <summary>Determines whether all the elements in a collection exist within a function.</summary>
90 <param name="collection">The collection from which elements of type <c>T</c> will be drawn to pass to <paramref name="predicate" />.</param>
91 <param name="predicate">The function to evaluate for the existence of all the elements in <paramref name="collection" />.</param>
92 <typeparam name="T">The type that is contained in <paramref name="collection" />.</typeparam>
94 <see langword="true" /> if and only if <paramref name="predicate" /> returns <see langword="true" /> for all elements of type <paramref name="T" /> in <paramref name="collection" />.</returns>
95 <exception cref="T:System.ArgumentNullException">
96 <paramref name="collection" /> or <paramref name="predicate" /> is <see langword="null" />.</exception>
98 <member name="M:System.Diagnostics.Contracts.Contract.Invariant(System.Boolean)">
99 <summary>Specifies an invariant contract for the enclosing method or property.</summary>
100 <param name="condition">The conditional expression to test.</param>
102 <member name="M:System.Diagnostics.Contracts.Contract.Invariant(System.Boolean,System.String)">
103 <summary>Specifies an invariant contract for the enclosing method or property, and displays a message if the condition for the contract fails.</summary>
104 <param name="condition">The conditional expression to test.</param>
105 <param name="userMessage">The message to display if the condition is <see langword="false" />.</param>
107 <member name="M:System.Diagnostics.Contracts.Contract.OldValue``1(``0)">
108 <summary>Represents values as they were at the start of a method or property.</summary>
109 <param name="value">The value to represent (field or parameter).</param>
110 <typeparam name="T">The type of value.</typeparam>
111 <returns>The value of the parameter or field at the start of a method or property.</returns>
113 <member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean)">
114 <summary>Specifies a precondition contract for the enclosing method or property.</summary>
115 <param name="condition">The conditional expression to test.</param>
117 <member name="M:System.Diagnostics.Contracts.Contract.Requires(System.Boolean,System.String)">
118 <summary>Specifies a precondition contract for the enclosing method or property, and displays a message if the condition for the contract fails.</summary>
119 <param name="condition">The conditional expression to test.</param>
120 <param name="userMessage">The message to display if the condition is <see langword="false" />.</param>
122 <member name="M:System.Diagnostics.Contracts.Contract.Requires``1(System.Boolean)">
123 <summary>Specifies a precondition contract for the enclosing method or property, and throws an exception if the condition for the contract fails.</summary>
124 <param name="condition">The conditional expression to test.</param>
125 <typeparam name="TException">The exception to throw if the condition is <see langword="false" />.</typeparam>
127 <member name="M:System.Diagnostics.Contracts.Contract.Requires``1(System.Boolean,System.String)">
128 <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>
129 <param name="condition">The conditional expression to test.</param>
130 <param name="userMessage">The message to display if the condition is <see langword="false" />.</param>
131 <typeparam name="TException">The exception to throw if the condition is <see langword="false" />.</typeparam>
133 <member name="M:System.Diagnostics.Contracts.Contract.Result``1">
134 <summary>Represents the return value of a method or property.</summary>
135 <typeparam name="T">Type of return value of the enclosing method or property.</typeparam>
136 <returns>Return value of the enclosing method or property.</returns>
138 <member name="M:System.Diagnostics.Contracts.Contract.ValueAtReturn``1(``0@)">
139 <summary>Represents the final (output) value of an <see langword="out" /> parameter when returning from a method.</summary>
140 <param name="value">The <see langword="out" /> parameter.</param>
141 <typeparam name="T">The type of the <see langword="out" /> parameter.</typeparam>
142 <returns>The output value of the <see langword="out" /> parameter.</returns>
144 <member name="T:System.Diagnostics.Contracts.ContractAbbreviatorAttribute">
145 <summary>Defines abbreviations that you can use in place of the full contract syntax.</summary>
147 <member name="M:System.Diagnostics.Contracts.ContractAbbreviatorAttribute.#ctor">
148 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractAbbreviatorAttribute" /> class.</summary>
150 <member name="T:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute">
151 <summary>Enables the factoring of legacy <see langword="if-then-throw" /> code into separate methods for reuse, and provides full control over thrown exceptions and arguments.</summary>
153 <member name="M:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute.#ctor">
154 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractArgumentValidatorAttribute" /> class.</summary>
156 <member name="T:System.Diagnostics.Contracts.ContractClassAttribute">
157 <summary>Specifies that a separate type contains the code contracts for this type.</summary>
159 <member name="M:System.Diagnostics.Contracts.ContractClassAttribute.#ctor(System.Type)">
160 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractClassAttribute" /> class.</summary>
161 <param name="typeContainingContracts">The type that contains the code contracts for this type.</param>
163 <member name="P:System.Diagnostics.Contracts.ContractClassAttribute.TypeContainingContracts">
164 <summary>Gets the type that contains the code contracts for this type.</summary>
165 <returns>The type that contains the code contracts for this type.</returns>
167 <member name="T:System.Diagnostics.Contracts.ContractClassForAttribute">
168 <summary>Specifies that a class is a contract for a type.</summary>
170 <member name="M:System.Diagnostics.Contracts.ContractClassForAttribute.#ctor(System.Type)">
171 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractClassForAttribute" /> class, specifying the type the current class is a contract for.</summary>
172 <param name="typeContractsAreFor">The type the current class is a contract for.</param>
174 <member name="P:System.Diagnostics.Contracts.ContractClassForAttribute.TypeContractsAreFor">
175 <summary>Gets the type that this code contract applies to.</summary>
176 <returns>The type that this contract applies to.</returns>
178 <member name="T:System.Diagnostics.Contracts.ContractFailedEventArgs">
179 <summary>Provides methods and data for the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed" /> event.</summary>
181 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.#ctor(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.Exception)">
182 <summary>Provides data for the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed" /> event.</summary>
183 <param name="failureKind">One of the enumeration values that specifies the contract that failed.</param>
184 <param name="message">The message for the event.</param>
185 <param name="condition">The condition for the event.</param>
186 <param name="originalException">The exception that caused the event.</param>
188 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Condition">
189 <summary>Gets the condition for the failure of the contract.</summary>
190 <returns>The condition for the failure.</returns>
192 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.FailureKind">
193 <summary>Gets the type of contract that failed.</summary>
194 <returns>One of the enumeration values that specifies the type of contract that failed.</returns>
196 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Handled">
197 <summary>Indicates whether the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed" /> event has been handled.</summary>
199 <see langword="true" /> if the event has been handled; otherwise, <see langword="false" />.</returns>
201 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Message">
202 <summary>Gets the message that describes the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed" /> event.</summary>
203 <returns>The message that describes the event.</returns>
205 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.OriginalException">
206 <summary>Gets the original exception that caused the <see cref="E:System.Diagnostics.Contracts.Contract.ContractFailed" /> event.</summary>
207 <returns>The exception that caused the event.</returns>
209 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.SetHandled">
210 <summary>Sets the <see cref="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Handled" /> property to <see langword="true" />.</summary>
212 <member name="M:System.Diagnostics.Contracts.ContractFailedEventArgs.SetUnwind">
213 <summary>Sets the <see cref="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Unwind" /> property to <see langword="true" />.</summary>
215 <member name="P:System.Diagnostics.Contracts.ContractFailedEventArgs.Unwind">
216 <summary>Indicates whether the code contract escalation policy should be applied.</summary>
218 <see langword="true" /> to apply the escalation policy; otherwise, <see langword="false" />. The default is <see langword="false" />.</returns>
220 <member name="T:System.Diagnostics.Contracts.ContractFailureKind">
221 <summary>Specifies the type of contract that failed.</summary>
223 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Assert">
224 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Assert" /> contract failed.</summary>
226 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Assume">
227 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Assume" /> contract failed.</summary>
229 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Invariant">
230 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Invariant" /> contract failed.</summary>
232 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Postcondition">
233 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.Ensures" /> contract failed.</summary>
235 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.PostconditionOnException">
236 <summary>An <see cref="Overload:System.Diagnostics.Contracts.Contract.EnsuresOnThrow" /> contract failed.</summary>
238 <member name="F:System.Diagnostics.Contracts.ContractFailureKind.Precondition">
239 <summary>A <see cref="Overload:System.Diagnostics.Contracts.Contract.Requires" /> contract failed.</summary>
241 <member name="T:System.Diagnostics.Contracts.ContractInvariantMethodAttribute">
242 <summary>Marks a method as being the invariant method for a class.</summary>
244 <member name="M:System.Diagnostics.Contracts.ContractInvariantMethodAttribute.#ctor">
245 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractInvariantMethodAttribute" /> class.</summary>
247 <member name="T:System.Diagnostics.Contracts.ContractOptionAttribute">
248 <summary>Enables you to set contract and tool options at assembly, type, or method granularity.</summary>
250 <member name="M:System.Diagnostics.Contracts.ContractOptionAttribute.#ctor(System.String,System.String,System.Boolean)">
251 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractOptionAttribute" /> class by using the provided category, setting, and enable/disable value.</summary>
252 <param name="category">The category for the option to be set.</param>
253 <param name="setting">The option setting.</param>
254 <param name="enabled">
255 <see langword="true" /> to enable the option; <see langword="false" /> to disable the option.</param>
257 <member name="M:System.Diagnostics.Contracts.ContractOptionAttribute.#ctor(System.String,System.String,System.String)">
258 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractOptionAttribute" /> class by using the provided category, setting, and value.</summary>
259 <param name="category">The category of the option to be set.</param>
260 <param name="setting">The option setting.</param>
261 <param name="value">The value for the setting.</param>
263 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Category">
264 <summary>Gets the category of the option.</summary>
265 <returns>The category of the option.</returns>
267 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Enabled">
268 <summary>Determines if an option is enabled.</summary>
270 <see langword="true" /> if the option is enabled; otherwise, <see langword="false" />.</returns>
272 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Setting">
273 <summary>Gets the setting for the option.</summary>
274 <returns>The setting for the option.</returns>
276 <member name="P:System.Diagnostics.Contracts.ContractOptionAttribute.Value">
277 <summary>Gets the value for the option.</summary>
278 <returns>The value for the option.</returns>
280 <member name="T:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute">
281 <summary>Specifies that a field can be used in method contracts when the field has less visibility than the method.</summary>
283 <member name="M:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute.#ctor(System.String)">
284 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute" /> class.</summary>
285 <param name="name">The property name to apply to the field.</param>
287 <member name="P:System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute.Name">
288 <summary>Gets the property name to be applied to the field.</summary>
289 <returns>The property name to be applied to the field.</returns>
291 <member name="T:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute">
292 <summary>Specifies that an assembly is a reference assembly that contains contracts.</summary>
294 <member name="M:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute.#ctor">
295 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute" /> class.</summary>
297 <member name="T:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute">
298 <summary>Identifies a member that has no run-time behavior.</summary>
300 <member name="M:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute.#ctor">
301 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute" /> class.</summary>
303 <member name="T:System.Diagnostics.Contracts.ContractVerificationAttribute">
304 <summary>Instructs analysis tools to assume the correctness of an assembly, type, or member without performing static verification.</summary>
306 <member name="M:System.Diagnostics.Contracts.ContractVerificationAttribute.#ctor(System.Boolean)">
307 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.ContractVerificationAttribute" /> class.</summary>
309 <see langword="true" /> to require verification; otherwise, <see langword="false" />.</param>
311 <member name="P:System.Diagnostics.Contracts.ContractVerificationAttribute.Value">
312 <summary>Gets the value that indicates whether to verify the contract of the target.</summary>
314 <see langword="true" /> if verification is required; otherwise, <see langword="false" />.</returns>
316 <member name="T:System.Diagnostics.Contracts.PureAttribute">
317 <summary>Indicates that a type or method is pure, that is, it does not make any visible state changes.</summary>
319 <member name="M:System.Diagnostics.Contracts.PureAttribute.#ctor">
320 <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Contracts.PureAttribute" /> class.</summary>
322 <member name="T:System.Runtime.CompilerServices.ContractHelper">
323 <summary>Provides methods that the binary rewriter uses to handle contract failures.</summary>
325 <member name="M:System.Runtime.CompilerServices.ContractHelper.RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.Exception)">
326 <summary>Used by the binary rewriter to activate the default failure behavior.</summary>
327 <param name="failureKind">One of the enumeration values that specifies the type of failure.</param>
328 <param name="userMessage">Additional user information.</param>
329 <param name="conditionText">The description of the condition that caused the failure.</param>
330 <param name="innerException">The inner exception that caused the current exception.</param>
331 <returns>A null reference (<see langword="Nothing" /> in Visual Basic) if the event was handled and should not trigger a failure; otherwise, returns the localized failure message.</returns>
332 <exception cref="T:System.ArgumentException">
333 <paramref name="failureKind" /> is not a valid <see cref="T:System.Diagnostics.Contracts.ContractFailureKind" /> value.</exception>
335 <member name="M:System.Runtime.CompilerServices.ContractHelper.TriggerFailure(System.Diagnostics.Contracts.ContractFailureKind,System.String,System.String,System.String,System.Exception)">
336 <summary>Triggers the default failure behavior.</summary>
337 <param name="kind">One of the enumeration values that specifies the type of failure.</param>
338 <param name="displayMessage">The message to display.</param>
339 <param name="userMessage">Additional user information.</param>
340 <param name="conditionText">The description of the condition that caused the failure.</param>
341 <param name="innerException">The inner exception that caused the current exception.</param>