Good day! How do I work with this in C #? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Good day! How do I work with this in C #?

environment.exit()

8th Jun 2021, 10:21 AM
‎أندريه‎
‎أندريه‎ - avatar
6 Answers
+ 3
Thank you!
9th Jun 2021, 1:30 PM
‎أندريه‎
‎أندريه‎ - avatar
+ 2
Thank you! Very good explanation, but still there are numbers 1, 2 ... could you please tell me how they affect the exit from the program
9th Jun 2021, 7:22 AM
‎أندريه‎
‎أندريه‎ - avatar
+ 2
What do you mean with Numbers 1 , 2 Please give more information
9th Jun 2021, 8:59 AM
sneeze
sneeze - avatar
+ 2
environment.exit (1), environment.exit (2) is
9th Jun 2021, 9:04 AM
‎أندريه‎
‎أندريه‎ - avatar
+ 2
It is the return code that the application gives back to the operating system. Just like return 0; in console applications. 0 is success, anything else indicates an error. There isn't a standard. Some programs try to meet conventions. https://stackoverflow.com/questions/11309675/what-are-the-default-values-that-can-be-passed-to-environment-exit-method Here's Microsoft's conventions. https://docs.microsoft.com/nl-nl/windows/win32/debug/system-error-codes--0-499-?redirectedfrom=MSDN
9th Jun 2021, 1:24 PM
sneeze
sneeze - avatar
+ 1
This piece of code is closing the current application. This comes in handy when you want to have a Close/Exit button on your form. It works just like the cross in the upper right corner.
8th Jun 2021, 11:31 AM
sneeze
sneeze - avatar