Resharper always suggesting me to make const string instead of string

后端 未结 4 2439
挽巷
挽巷 2021-02-20 13:38

which one is good:

string sQuery = \"SELECT * FROM table\";

or

const string sQuery = \"SELECT * FROM table\";
<
4条回答
  •  青春惊慌失措
    2021-02-20 14:26

    ReSharper only suggests this if the particular string reference never changes. In that case you express your intend by using const string instead of just string.

提交回复
热议问题