using System;
using System.Collections.Generic;
using System.Text;
namespace Google.ProtocolBuffers {
///
/// Helper methods for throwing exceptions
///
public static class ThrowHelper {
///
/// Throws an ArgumentNullException if the given value is null.
///
public static void ThrowIfNull(object value, string name) {
if (value == null) {
throw new ArgumentNullException(name);
}
}
///
/// Throws an ArgumentNullException if the given value is null.
///
public static void ThrowIfNull(object value) {
if (value == null) {
throw new ArgumentNullException();
}
}
///
/// Throws an ArgumentNullException if the given value or any element within it is null.
///
public static void ThrowIfAnyNull(IEnumerable sequence) {
foreach (T t in sequence) {
if (t == null) {
throw new ArgumentNullException();
}
}
}
}
}