Is there a way to determine whether or not a given .Net Type is a number? For example: System.UInt32/UInt16/Double are all numbers. I want to avoid a long switc
System.UInt32/UInt16/Double
Try the TypeSupport nuget package for C#. It has support for detecting all numeric types (among many other features):
var extendedType = typeof(int).GetExtendedType(); Assert.IsTrue(extendedType.IsNumericType);