CriteriaOperator.FormatConstantValue(Object) Method
Converts an object to a string that can be used in criteria expressions.
Namespace: DevExpress.Data.Filtering
Assembly: DevExpress.Data.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
value | Object | An object to convert. |
Returns
Type | Description |
---|---|
String | A string that can be used in criteria expressions. |
Remarks
Use the FormatPropertyName static method to format constant values used in criteria expressions:
var dateTimeString = CriteriaOperator.FormatConstantValue(new DateTime(2022, 2, 1));
// "#2022-02-01#"
var singleString = CriteriaOperator.FormatConstantValue(((Single)Math.Round(Math.PI, 2)));
// "3.14f"
var constString = CriteriaOperator.FormatConstantValue("foo'tab");
// "'foo''tab'"
Important
Use the FormatConstantValue to format a user input. This method neutralizes (escapes) special characters, so a user cannot accidentally break your code or inject malicious logic into a criteria expression. Refer to the following article for more information: Improper Neutralization of Special Elements in Data Query Logic
See Also