Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 |
|
---|
6 | namespace 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.