System.Double is a value type, and cannot be null (i.e. double d = null; is not valid).
The "as" keyword is used to try to store an object from one reference type to another. It returns null if the object is not of the correct type.
The "is" keyword returns true if the above transfer would work.
What you probably want to use is Double.TryParse(object, ref double);
public static double setDefaultDoubleValue(string textValue)
{
double d;
return double.TryParse(textValue, ref d) ? d : 0.00;
}
/- Sam Judson : Wrox Technical Editor -/
|