public ValueArray(T[] array) { ContractUtils.RequiresNotNull(array, "array"); ContractUtils.RequiresNotNullItems(array, "array"); _array = array; }
public CovariantConvertor(IEnumerable <T> enumerable) { ContractUtils.RequiresNotNull(enumerable, "enumerable"); _enumerable = enumerable; }
public static StringBuilder FormatSignature(StringBuilder result, MethodBase method, Func <Type, string> nameDispenser) { ContractUtils.RequiresNotNull(result, "result"); ContractUtils.RequiresNotNull(method, "method"); ContractUtils.RequiresNotNull(nameDispenser, "nameDispenser"); MethodInfo methodInfo = method as MethodInfo; if (methodInfo != null) { FormatTypeName(result, methodInfo.ReturnType, nameDispenser); result.Append(' '); } MethodBuilder builder = method as MethodBuilder; if (builder != null) { result.Append(builder.Signature); return(result); } ConstructorBuilder cb = method as ConstructorBuilder; if (cb != null) { result.Append(cb.Signature); return(result); } FormatTypeName(result, method.DeclaringType, nameDispenser); result.Append("::"); result.Append(method.Name); if (!method.IsConstructor) { FormatTypeArgs(result, method.GetGenericArguments(), nameDispenser); } result.Append("("); if (!method.ContainsGenericParameters) { ParameterInfo[] ps = method.GetParameters(); for (int i = 0; i < ps.Length; i++) { if (i > 0) { result.Append(", "); } FormatTypeName(result, ps[i].ParameterType, nameDispenser); if (!System.String.IsNullOrEmpty(ps[i].Name)) { result.Append(" "); result.Append(ps[i].Name); } } } else { result.Append("?"); } result.Append(")"); return(result); }
public static void IsTrue(Func <bool> predicate) { ContractUtils.RequiresNotNull(predicate, nameof(predicate)); Debug.Assert(predicate()); }