I am about to replace all the literal string in the message with the constants. But really wanted to know is there any performance optimization behind this or is just for following coding standards. In below sample I have class Constants.
What are benefits of
var a=xmlNode.SelectNodes(Constants.DimLink);
Over
var a=xmlNode.SelectNodes("DimensionPointLink");
Using Constants
will gain you with maintainability, ease of development and less error prone and not performance.
For instance you use the Constants.DimLink
at multiple places in your code, then if in case it's value need to be changed, you need to change in just single place, making your code more maintainable and less error prone.
You will also find constants helpful if you group the constant values as per their usages, then VS intellisence will help developer is using the correct constant value. This will help in consistency of application.