Do you get the value in string form? If this is the case, there is no way to say unambiguously which one is there, because there are certain numbers that can be represented by both types (quite a lot actually). But we can say that this is one or the other.
public bool IsFloatOrInt(string value) { int intValue; float floatValue; return Int32.TryParse(value, out intValue) || float.TryParse(value, out floatValue); }
Jaredpar
source share