main
1using System;
2
3namespace solidware.financials.windows.ui.views.controls
4{
5 static public class ObjectExtensions
6 {
7 static public bool IsNumeric(this object value)
8 {
9 return value.Is<short>() || value.Is<int>() || value.Is<long>() || value.Is<decimal>() || value.Is<float>() || value.Is<double>();
10 }
11
12 static public bool IsNull<T>(this T item) where T : class
13 {
14 return item == null;
15 }
16
17 static public bool Is<T>(this object value)
18 {
19 return value is T;
20 }
21
22 static public T As<T>(this object value)
23 {
24 if (value is T)
25 return (T) value;
26 if (value is Observable)
27 return (T) ((Observable) value).Value;
28 return (T) Convert.ChangeType(value, typeof (T));
29 }
30 }
31}