aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/Utils
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-08-09 15:37:23 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-08-10 21:05:16 -0700
commit39a9ec8954ccd13367918c615f9efd9a5aaf3b9f (patch)
treeb7611986fbac6c11ac0ad60faa8a929c2a2bf863 /src/csharp/Grpc.Core/Utils
parent801bbeb7b461cf46fda72be9f9f0d00f6ccc0e29 (diff)
fix preconditions class
Diffstat (limited to 'src/csharp/Grpc.Core/Utils')
-rw-r--r--src/csharp/Grpc.Core/Utils/Preconditions.cs25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/csharp/Grpc.Core/Utils/Preconditions.cs b/src/csharp/Grpc.Core/Utils/Preconditions.cs
index aeb5d210a7..374262f87a 100644
--- a/src/csharp/Grpc.Core/Utils/Preconditions.cs
+++ b/src/csharp/Grpc.Core/Utils/Preconditions.cs
@@ -32,17 +32,16 @@
#endregion
using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Threading.Tasks;
namespace Grpc.Core.Utils
{
+ /// <summary>
+ /// Utility methods to simplify checking preconditions in the code.
+ /// </summary>
public static class Preconditions
{
/// <summary>
- /// Throws ArgumentException if condition is false.
+ /// Throws <see cref="ArgumentException"/> if condition is false.
/// </summary>
public static void CheckArgument(bool condition)
{
@@ -53,7 +52,7 @@ namespace Grpc.Core.Utils
}
/// <summary>
- /// Throws ArgumentException with given message if condition is false.
+ /// Throws <see cref="ArgumentException"/> with given message if condition is false.
/// </summary>
public static void CheckArgument(bool condition, string errorMessage)
{
@@ -64,31 +63,31 @@ namespace Grpc.Core.Utils
}
/// <summary>
- /// Throws NullReferenceException if reference is null.
+ /// Throws <see cref="ArgumentNullException"/> if reference is null.
/// </summary>
public static T CheckNotNull<T>(T reference)
{
if (reference == null)
{
- throw new NullReferenceException();
+ throw new ArgumentNullException();
}
return reference;
}
/// <summary>
- /// Throws NullReferenceException with given message if reference is null.
+ /// Throws <see cref="ArgumentNullException"/> if reference is null.
/// </summary>
- public static T CheckNotNull<T>(T reference, string errorMessage)
+ public static T CheckNotNull<T>(T reference, string paramName)
{
if (reference == null)
{
- throw new NullReferenceException(errorMessage);
+ throw new ArgumentNullException(paramName);
}
return reference;
}
/// <summary>
- /// Throws InvalidOperationException if condition is false.
+ /// Throws <see cref="InvalidOperationException"/> if condition is false.
/// </summary>
public static void CheckState(bool condition)
{
@@ -99,7 +98,7 @@ namespace Grpc.Core.Utils
}
/// <summary>
- /// Throws InvalidOperationException with given message if condition is false.
+ /// Throws <see cref="InvalidOperationException"/> with given message if condition is false.
/// </summary>
public static void CheckState(bool condition, string errorMessage)
{