blob: 786ec4f42b2803eb1b176bb42dfb41ce8e5146f0 [file] [log] [blame]
using System;
namespace OfficeOpenXml.FormulaParsing.Utilities;
public static class ExtensionMethods {
public static void IsNotNullOrEmpty(this ArgumentInfo<string> val) {
if (string.IsNullOrEmpty(val.Value)) {
throw new ArgumentException(val.Name + " cannot be null or empty");
}
}
public static void IsNotNull<T>(this ArgumentInfo<T> val)
where T : class {
if (val.Value == null) {
throw new ArgumentNullException(val.Name);
}
}
public static bool IsNumeric(this object obj) {
if (obj == null) {
return false;
}
return (obj.GetType().IsPrimitive
|| obj is double
|| obj is decimal
|| obj is DateTime
|| obj is TimeSpan);
}
}