Cell PutValue method overloads

Is there a difference between calling the Cell.PutValue overload if I know the type of my value vs just calling Cell.PutValue(object)?

As an example, I have a method that accepts an object parameter. Do I get any benefit from checking if the object’s type is int, so I can cast it to an int and call Cell.PutValue(int)?

@vonH,

If you know the value type, then it is better you use the relevant overload of Cell.PutValue() method. If you want Aspose.Cells should convert to proper data type, you may use Cell.PutValue(string stringValue, bool isConverted) → put “true” for the second parameter so value would be converted to relevant type automatically.

1 Like

@vonH,
If you use the relevant overload of Cell.PutValue() method, it will improve program performance. Because when you pass in an object to a method, we will parse the parameter and determine the type, and then call the corresponding overloaded method to set the value.

1 Like