private static void Validate(Type type, bool allowByRef)
{
ContractUtils.RequiresNotNull(type, nameof(type));
TypeUtils.ValidateType(type, nameof(type), allowByRef, allowPointer: false);
if (type == typeof(void))
{
throw Error.ArgumentCannotBeOfTypeVoid(nameof(type));
}
}