Class EnsureThat
Syntax
Methods
Any<T>(T[], Func<T, Boolean>)
Declaration
public void Any<T>(T[] value, Func<T, bool> predicate)
Parameters
Type |
Name |
Description |
T[] |
value |
|
Func<T, Boolean> |
predicate |
|
Type Parameters
Any<T>(ICollection<T>, Func<T, Boolean>)
Declaration
public void Any<T>(ICollection<T> value, Func<T, bool> predicate)
Parameters
Type Parameters
Any<T>(IList<T>, Func<T, Boolean>)
Declaration
public void Any<T>(IList<T> value, Func<T, bool> predicate)
Parameters
Type Parameters
HasAttribute(Type, Type)
Declaration
public void HasAttribute(Type param, Type attributeType)
Parameters
Type |
Name |
Description |
Type |
param |
|
Type |
attributeType |
|
HasAttribute<TAttribute>(Type)
Declaration
public void HasAttribute<TAttribute>(Type param)
where TAttribute : Attribute
Parameters
Type |
Name |
Description |
Type |
param |
|
Type Parameters
Name |
Description |
TAttribute |
|
HasConstructorAccepting(Type, Type[])
Declaration
public void HasConstructorAccepting(Type param, params Type[] parameterTypes)
Parameters
Type |
Name |
Description |
Type |
param |
|
Type[] |
parameterTypes |
|
HasItems<T>(T)
Declaration
public void HasItems<T>(T value)
where T : class, ICollection
Parameters
Type |
Name |
Description |
T |
value |
|
Type Parameters
HasItems<T>(T[])
Declaration
public void HasItems<T>(T[] value)
Parameters
Type |
Name |
Description |
T[] |
value |
|
Type Parameters
HasItems<T>(ICollection<T>)
Declaration
public void HasItems<T>(ICollection<T> value)
Parameters
Type Parameters
HasItems<T>(IList<T>)
Declaration
public void HasItems<T>(IList<T> value)
Parameters
Type |
Name |
Description |
IList<T> |
value |
|
Type Parameters
HasItems<TKey, TValue>(IDictionary<TKey, TValue>)
Declaration
public void HasItems<TKey, TValue>(IDictionary<TKey, TValue> value)
Parameters
Type Parameters
Name |
Description |
TKey |
|
TValue |
|
HasLengthBetween(String, Int32, Int32)
Declaration
public void HasLengthBetween(string value, int minLength, int maxLength)
Parameters
HasNoNullItem<T>(T)
Declaration
public void HasNoNullItem<T>(T value)
where T : class, IEnumerable
Parameters
Type |
Name |
Description |
T |
value |
|
Type Parameters
HasPublicConstructorAccepting(Type, Type[])
Declaration
public void HasPublicConstructorAccepting(Type param, params Type[] parameterTypes)
Parameters
Type |
Name |
Description |
Type |
param |
|
Type[] |
parameterTypes |
|
Is<T>(T, T)
Declaration
public void Is<T>(T param, T expected)
where T : struct, IComparable<T>
Parameters
Type |
Name |
Description |
T |
param |
|
T |
expected |
|
Type Parameters
IsEqualTo(String, String)
Declaration
public void IsEqualTo(string value, string expected)
Parameters
IsEqualTo(String, String, StringComparison)
Declaration
public void IsEqualTo(string value, string expected, StringComparison comparison)
Parameters
IsFalse(Boolean)
Declaration
public void IsFalse(bool value)
Parameters
Type |
Name |
Description |
Boolean |
value |
|
IsGt<T>(T, T)
Declaration
public void IsGt<T>(T param, T limit)
where T : struct, IComparable<T>
Parameters
Type |
Name |
Description |
T |
param |
|
T |
limit |
|
Type Parameters
IsGte<T>(T, T)
Declaration
public void IsGte<T>(T param, T limit)
where T : struct, IComparable<T>
Parameters
Type |
Name |
Description |
T |
param |
|
T |
limit |
|
Type Parameters
IsGuid(String)
Declaration
public void IsGuid(string value)
Parameters
Type |
Name |
Description |
String |
value |
|
IsInRange<T>(T, T, T)
Declaration
public void IsInRange<T>(T param, T min, T max)
where T : struct, IComparable<T>
Parameters
Type |
Name |
Description |
T |
param |
|
T |
min |
|
T |
max |
|
Type Parameters
IsKeyOf<TKey, TValue>(IDictionary<TKey, TValue>, TKey, String)
Declaration
public void IsKeyOf<TKey, TValue>(IDictionary<TKey, TValue> value, TKey expectedKey, string keyLabel = null)
Parameters
Type |
Name |
Description |
IDictionary<TKey, TValue> |
value |
|
TKey |
expectedKey |
|
String |
keyLabel |
|
Type Parameters
Name |
Description |
TKey |
|
TValue |
|
IsLt<T>(T, T)
Declaration
public void IsLt<T>(T param, T limit)
where T : struct, IComparable<T>
Parameters
Type |
Name |
Description |
T |
param |
|
T |
limit |
|
Type Parameters
IsLte<T>(T, T)
Declaration
public void IsLte<T>(T param, T limit)
where T : struct, IComparable<T>
Parameters
Type |
Name |
Description |
T |
param |
|
T |
limit |
|
Type Parameters
IsNot<T>(T, T)
Declaration
public void IsNot<T>(T param, T expected)
where T : struct, IComparable<T>
Parameters
Type |
Name |
Description |
T |
param |
|
T |
expected |
|
Type Parameters
IsNotDefault<T>(T)
Declaration
public void IsNotDefault<T>(T param)
where T : struct
Parameters
Type |
Name |
Description |
T |
param |
|
Type Parameters
IsNotEmpty(Guid)
Declaration
public void IsNotEmpty(Guid value)
Parameters
Type |
Name |
Description |
Guid |
value |
|
IsNotEmpty(String)
Declaration
public void IsNotEmpty(string value)
Parameters
Type |
Name |
Description |
String |
value |
|
IsNotEqualTo(String, String)
Declaration
public void IsNotEqualTo(string value, string expected)
Parameters
IsNotEqualTo(String, String, StringComparison)
Declaration
public void IsNotEqualTo(string value, string expected, StringComparison comparison)
Parameters
IsNotNull(String)
Declaration
public void IsNotNull(string value)
Parameters
Type |
Name |
Description |
String |
value |
|
IsNotNull<T>(T)
Declaration
public void IsNotNull<T>([NoEnumeration] T value)
Parameters
Type |
Name |
Description |
T |
value |
|
Type Parameters
IsNotNull<T>(Nullable<T>)
Declaration
public void IsNotNull<T>(T? value)
where T : struct
Parameters
Type Parameters
IsNotNullOrEmpty(String)
Declaration
public void IsNotNullOrEmpty(string value)
Parameters
Type |
Name |
Description |
String |
value |
|
IsNotNullOrWhiteSpace(String)
Declaration
public void IsNotNullOrWhiteSpace(string value)
Parameters
Type |
Name |
Description |
String |
value |
|
IsNull<T>(T)
Declaration
public void IsNull<T>([NoEnumeration] T value)
Parameters
Type |
Name |
Description |
T |
value |
|
Type Parameters
IsOfType(Type, Type)
Declaration
public void IsOfType(Type param, Type expectedType)
Parameters
Type |
Name |
Description |
Type |
param |
|
Type |
expectedType |
|
IsOfType<T>(T, Type)
Declaration
public void IsOfType<T>(T param, Type expectedType)
Parameters
Type |
Name |
Description |
T |
param |
|
Type |
expectedType |
|
Type Parameters
IsOfType<T>(Object)
Declaration
public void IsOfType<T>(object param)
Parameters
Type |
Name |
Description |
Object |
param |
|
Type Parameters
IsOfType<T>(Type)
Declaration
public void IsOfType<T>(Type param)
Parameters
Type |
Name |
Description |
Type |
param |
|
Type Parameters
IsTrue(Boolean)
Declaration
public void IsTrue(bool value)
Parameters
Type |
Name |
Description |
Boolean |
value |
|
Matches(String, Regex)
Declaration
public void Matches(string value, Regex match)
Parameters
Type |
Name |
Description |
String |
value |
|
Regex |
match |
|
Matches(String, String)
Declaration
public void Matches(string value, string match)
Parameters
SizeIs(String, Int32)
Declaration
public void SizeIs(string value, int expected)
Parameters
SizeIs<T>(T, Int32)
Declaration
public void SizeIs<T>(T value, int expected)
where T : ICollection
Parameters
Type |
Name |
Description |
T |
value |
|
Int32 |
expected |
|
Type Parameters
SizeIs<T>(T, Int64)
Declaration
public void SizeIs<T>(T value, long expected)
where T : ICollection
Parameters
Type |
Name |
Description |
T |
value |
|
Int64 |
expected |
|
Type Parameters
SizeIs<T>(T[], Int32)
Declaration
public void SizeIs<T>(T[] value, int expected)
Parameters
Type |
Name |
Description |
T[] |
value |
|
Int32 |
expected |
|
Type Parameters
SizeIs<T>(T[], Int64)
Declaration
public void SizeIs<T>(T[] value, long expected)
Parameters
Type |
Name |
Description |
T[] |
value |
|
Int64 |
expected |
|
Type Parameters
SizeIs<T>(ICollection<T>, Int32)
Declaration
public void SizeIs<T>(ICollection<T> value, int expected)
Parameters
Type Parameters
SizeIs<T>(ICollection<T>, Int64)
Declaration
public void SizeIs<T>(ICollection<T> value, long expected)
Parameters
Type Parameters
SizeIs<T>(IList<T>, Int32)
Declaration
public void SizeIs<T>(IList<T> value, int expected)
Parameters
Type |
Name |
Description |
IList<T> |
value |
|
Int32 |
expected |
|
Type Parameters
SizeIs<T>(IList<T>, Int64)
Declaration
public void SizeIs<T>(IList<T> value, long expected)
Parameters
Type |
Name |
Description |
IList<T> |
value |
|
Int64 |
expected |
|
Type Parameters
SizeIs<TKey, TValue>(IDictionary<TKey, TValue>, Int32)
Declaration
public void SizeIs<TKey, TValue>(IDictionary<TKey, TValue> value, int expected)
Parameters
Type Parameters
Name |
Description |
TKey |
|
TValue |
|
SizeIs<TKey, TValue>(IDictionary<TKey, TValue>, Int64)
Declaration
public void SizeIs<TKey, TValue>(IDictionary<TKey, TValue> value, long expected)
Parameters
Type Parameters
Name |
Description |
TKey |
|
TValue |
|
Extension Methods
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.