if ((double)_feature.get_Value(_feature.Fields.FindField("MYFIELD")) > 8.33)
_feature.get_Value(_feature.Fields.FindField("MYFIELD")).ToString()
What do you get when you do this?_feature.get_Value(_feature.Fields.FindField("MYFIELD")).ToString()
If the value in the field is null, you will not be able to cast it to double. When there is a null value in a field, .net returns a dbnull.value which cannot be cast to a double even if the field type is double. Perhaps this is the problem.
cannot perform the operator on "object" and "double"
ToString will fail if the object is dbnull value. Happens all the time, you have to check for that every time, it is a real pain. If the type returned was a AO type, I would write an extension to check for that but I hesitate on writing extensions for type object.
Public Shared Function DatabaseToDouble(ByVal value As Object) As Double If value Is DBNull.Value Then Return 0 Else Return Convert.ToDouble(value) End If End Function
Public Shared Function DatabaseToDouble(ByVal value As Object, ByVal defaultValue As Double) As Double If value Is DBNull.Value Then Return defaultValue Else Return Convert.ToDouble(value) End If End Function