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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -