C # Will "WindowState.ToString" change between cultures
Take the following code for example:
if (Convert.ToString(frm.WindowState) == "Minimized")
Layout.WindowState = "Maximized";
else
Layout.WindowState = Convert.ToString(frm.WindowState);
We are analyzing the definition of the window status bar i.e. "Minimized".
Will this string description change between cultures?
Finally, while this code has an Enum that we could use to check the state of the window?
Can we refactor this code segment?
+1
source to share
3 answers
The value WindowState
is an enumeration - System.Windows.Forms.FormWindowState
. Just compare to enum constants, skip the madness ToString()
.
+8
source to share