Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Assume Method (Boolean)
Collapse the table of content
Expand the table of content

Contract.Assume Method (Boolean)

Instructs code analysis tools to assume that the specified condition is true, even if it cannot be statically proven to always be true.

Namespace:  System.Diagnostics.Contracts
Assemblies:   mscorlib (in mscorlib.dll)
  System.Diagnostics.Contracts (in System.Diagnostics.Contracts.dll)

[ConditionalAttribute("DEBUG")]
[ConditionalAttribute("CONTRACTS_FULL")]
public static void Assume(
	bool condition
)

Parameters

condition
Type: System.Boolean

The conditional expression to assume true.

At run time, using this method is equivalent to using the Assert(Boolean) method.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft