Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/ExtensionMethods.cs

Last change on this file was 12074, checked in by sraggl, 10 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 968 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace OfficeOpenXml.FormulaParsing.Utilities
7{
8    public static class ExtensionMethods
9    {
10        public static void IsNotNullOrEmpty(this ArgumentInfo<string> val)
11        {
12            if (string.IsNullOrEmpty(val.Value))
13            {
14                throw new ArgumentException(val.Name + " cannot be null or empty");
15            }
16        }
17
18        public static void IsNotNull<T>(this ArgumentInfo<T> val)
19            where T : class
20        {
21            if (val.Value == null)
22            {
23                throw new ArgumentNullException(val.Name);
24            }
25        }
26
27        public static bool IsNumeric(this object obj)
28        {
29            if (obj == null) return false;
30            return (obj.GetType().IsPrimitive || obj is double || obj is decimal || obj is System.DateTime || obj is TimeSpan);
31        }
32    }
33}
Note: See TracBrowser for help on using the repository browser.