c# - Is String culture info important for comparison if the user will never modify those strings -
when comparing hard-coded strings user see not modify/change, culture info important.
i assume not, want safe.
example:
static void main() { string hardstring = "iamhardcodei"; string hardstring2 = "iamhardcodei"; //compare hardstring , hardstring2, ignoring case, //and stuff based on result }
the general recommendation string comparisons when "programmatic strings" (i.e. specified not usable or editable user directly the: stringcomparison.ordinal[ignorecase]
.
see post (of duplicate): which best use -- stringcomparison.ordinalignorecase or stringcomparison.invariantcultureignorecase?
Comments
Post a Comment