问题
I want to set value appconfig key,but value contains & character.I tried double && like this "8L&&L26X0s8@P" but dont working.Can you help me please?
<add key="SAP_PASS" value="8L&L26X0s8@P"/>
回答1:
As app.config
is xml
file, use XML
entities for this.
Specifically &
is coded as &
(including the semicolon) in XML
.
回答2:
have you tried &
? This is the usual escape
回答3:
You can escape any character using Regex.Escape(string)
来源:https://stackoverflow.com/questions/35061018/escape-character-in-string