Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Environment Exit (??)

Environment Exit (??)

Scheduled Pinned Locked Moved C#
questioncsharpworkspace
16 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Midnight Ahri
    wrote on last edited by
    #1

    i'm new in C# and i'm a bit curious with something inside Environment Exit. don't care what number i put inside, it's just the same, so what is it for? Thanks before :laugh:

    L V P 3 Replies Last reply
    0
    • M Midnight Ahri

      i'm new in C# and i'm a bit curious with something inside Environment Exit. don't care what number i put inside, it's just the same, so what is it for? Thanks before :laugh:

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      They invented "documentation", it is quite good at the level of classes and methods. And if you can't find it right away, a search engine could help you out. :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      R 1 Reply Last reply
      0
      • M Midnight Ahri

        i'm new in C# and i'm a bit curious with something inside Environment Exit. don't care what number i put inside, it's just the same, so what is it for? Thanks before :laugh:

        V Offline
        V Offline
        VJ Reddy
        wrote on last edited by
        #3

        See this post http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx[^] I think it may be helpful to you.

        V D 2 Replies Last reply
        0
        • M Midnight Ahri

          i'm new in C# and i'm a bit curious with something inside Environment Exit. don't care what number i put inside, it's just the same, so what is it for? Thanks before :laugh:

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          It's needless, don't use it.

          J 1 Reply Last reply
          0
          • L Luc Pattyn

            They invented "documentation", it is quite good at the level of classes and methods. And if you can't find it right away, a search engine could help you out. :)

            Luc Pattyn [My Articles] Nil Volentibus Arduum

            R Offline
            R Offline
            Roger Wright
            wrote on last edited by
            #5

            Luc Pattyn wrote:

            They invented "documentation"

            And Microsoft killed it by eliminating actual manuals, providing us with MSDN in place of useful books. X|

            Will Rogers never met me.

            D 1 Reply Last reply
            0
            • V VJ Reddy

              See this post http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx[^] I think it may be helpful to you.

              V Offline
              V Offline
              Vipin_Arora
              wrote on last edited by
              #6

              +5 for informative link

              Happy Coding... :)

              V 1 Reply Last reply
              0
              • V Vipin_Arora

                +5 for informative link

                Happy Coding... :)

                V Offline
                V Offline
                VJ Reddy
                wrote on last edited by
                #7

                Thank you, Vipin.

                1 Reply Last reply
                0
                • R Roger Wright

                  Luc Pattyn wrote:

                  They invented "documentation"

                  And Microsoft killed it by eliminating actual manuals, providing us with MSDN in place of useful books. X|

                  Will Rogers never met me.

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  The only difference between a Microsoft book and MSDN is the binding is missing on MSDN.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak

                  1 Reply Last reply
                  0
                  • V VJ Reddy

                    See this post http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx[^] I think it may be helpful to you.

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    Congratulations! You just gave him a fish instead of teaching him how to catch his own fish.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak

                    1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      It's needless, don't use it.

                      J Offline
                      J Offline
                      jschell
                      wrote on last edited by
                      #10

                      PIEBALDconsult wrote:

                      It's needless, don't use it.

                      No it isn't. If one creates a windows service and threads remain running when the service does a normal exit then the service will continue to run requiring one to kill it. Exit() terminates all threads. And if one wants to do dynamic batch processing or any other process management processing with executables then Exit() can be used to return information to the caller. This is normally going to be less useful than services but since the only way to truly isolate unmanaged code is in another process it can on rare occassions be useful.

                      P M 2 Replies Last reply
                      0
                      • J jschell

                        PIEBALDconsult wrote:

                        It's needless, don't use it.

                        No it isn't. If one creates a windows service and threads remain running when the service does a normal exit then the service will continue to run requiring one to kill it. Exit() terminates all threads. And if one wants to do dynamic batch processing or any other process management processing with executables then Exit() can be used to return information to the caller. This is normally going to be less useful than services but since the only way to truly isolate unmanaged code is in another process it can on rare occassions be useful.

                        P Offline
                        P Offline
                        PIEBALDconsult
                        wrote on last edited by
                        #11

                        jschell wrote:

                        and threads remain running when the service does a normal exit

                        Then you're doing something wrong.

                        J 1 Reply Last reply
                        0
                        • J jschell

                          PIEBALDconsult wrote:

                          It's needless, don't use it.

                          No it isn't. If one creates a windows service and threads remain running when the service does a normal exit then the service will continue to run requiring one to kill it. Exit() terminates all threads. And if one wants to do dynamic batch processing or any other process management processing with executables then Exit() can be used to return information to the caller. This is normally going to be less useful than services but since the only way to truly isolate unmanaged code is in another process it can on rare occassions be useful.

                          M Offline
                          M Offline
                          Midnight Ahri
                          wrote on last edited by
                          #12

                          i'm doing my C# animation project, just like i said, i'm new and i learned : * switch case * do while * if * environment exit all over google chrome with 20 tab yesterday. in result, i created a bouncing ball in box. the point is, i'm just curious WHAT IS 0 IN ENVIRONMENT EXIT. i searched all over the universe and what i found is just it is exit code to send to machine or whatever. what i need is just something more than that, NOT FISH. so don't think i'm not doing anything, and again, if you're not going to answer my question, don't post anything. i'm not the one who ask before stuck like hell. (although that thing didn't stuck my app) :laugh:

                          J S 2 Replies Last reply
                          0
                          • P PIEBALDconsult

                            jschell wrote:

                            and threads remain running when the service does a normal exit

                            Then you're doing something wrong.

                            J Offline
                            J Offline
                            jschell
                            wrote on last edited by
                            #13

                            PIEBALDconsult wrote:

                            Then you're doing something wrong.

                            Presumably you in not having an correct way to shut down all threads, then I would agree to the extent that I would prefer to have such a method, and at least attempt that in my own code. But since some of the services I manage deal with disparate code sources (and developers) which might include up to 20 sources I can't insure that. Exit() however does insure it.

                            P 1 Reply Last reply
                            0
                            • M Midnight Ahri

                              i'm doing my C# animation project, just like i said, i'm new and i learned : * switch case * do while * if * environment exit all over google chrome with 20 tab yesterday. in result, i created a bouncing ball in box. the point is, i'm just curious WHAT IS 0 IN ENVIRONMENT EXIT. i searched all over the universe and what i found is just it is exit code to send to machine or whatever. what i need is just something more than that, NOT FISH. so don't think i'm not doing anything, and again, if you're not going to answer my question, don't post anything. i'm not the one who ask before stuck like hell. (although that thing didn't stuck my app) :laugh:

                              J Offline
                              J Offline
                              jschell
                              wrote on last edited by
                              #14

                              Alpherattz wrote:

                              i'm just curious WHAT IS 0 IN ENVIRONMENT EXIT.

                              Traditionally zero means that the application exited 'successfully'. A positive value is considered an error and a negative a warning. HOWEVER, that is a very loose convention. If no value is specified then an application (standard desktop OSes) will always have a zero value.

                              Alpherattz wrote:

                              and again, if you're not going to answer my question, don't post anything.

                              Pretty sure that all of the posts were in fact "answers". The fact that they are not the answers you expected doesn't alter that.

                              1 Reply Last reply
                              0
                              • J jschell

                                PIEBALDconsult wrote:

                                Then you're doing something wrong.

                                Presumably you in not having an correct way to shut down all threads, then I would agree to the extent that I would prefer to have such a method, and at least attempt that in my own code. But since some of the services I manage deal with disparate code sources (and developers) which might include up to 20 sources I can't insure that. Exit() however does insure it.

                                P Offline
                                P Offline
                                PIEBALDconsult
                                wrote on last edited by
                                #15

                                jschell wrote:

                                disparate code sources (and developers)

                                Yep, sounds wrong to me. :-D (Not that I have any answers on how to fix it.)

                                1 Reply Last reply
                                0
                                • M Midnight Ahri

                                  i'm doing my C# animation project, just like i said, i'm new and i learned : * switch case * do while * if * environment exit all over google chrome with 20 tab yesterday. in result, i created a bouncing ball in box. the point is, i'm just curious WHAT IS 0 IN ENVIRONMENT EXIT. i searched all over the universe and what i found is just it is exit code to send to machine or whatever. what i need is just something more than that, NOT FISH. so don't think i'm not doing anything, and again, if you're not going to answer my question, don't post anything. i'm not the one who ask before stuck like hell. (although that thing didn't stuck my app) :laugh:

                                  S Offline
                                  S Offline
                                  S 53K S
                                  wrote on last edited by
                                  #16

                                  Environment.Exit(code) will help you exit the application in a safe manner.Basically you are sending a message to the system that the application exited on it own and was not terminated due to an error.If the application really has terminated to error it notifies the system what is the error code. 0 is to tell the system that the current running application exited safely without errors. You can get some info on these codes here http://www.hiteksoftware.com/knowledge/articles/049.htm[^]

                                  Sastry

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups