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
U

User 11360346

@User 11360346
About
Posts
15
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    They make sense since the Op knows that there is socket related exception which Op wrote to it's own catch block. To me the the code was only getting SocketException for a while and then he got other excepion which it couldn't caught by SocketException and then he added the same catch code block with Exception without taking the account of future coders since he got relief at that moment.

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    No that is not the intension. Op misses to implement the appropriate logic behind once the error occurred in SocketException which he copied similar catch block in the Exception block.

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    See my reply here. [^]

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    Yes you do need to have the catch block. In fact you may need to add more based on what Dosomething()does. What op need to do is to implement the appropriate logic in the catch block which I already said it in my first response.

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    :)

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    The fact that you still ignore the Dosomething() method do, you generalize that both catches block get the same exception. Even I gave you example that the method might throw DBException and you expect the SocketException get exception based on your assumption.

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    Are you saying the message will always be the same ? This is a trick, If you do get it. :)

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    It does matter, a self ref [^] How do you know the code executed the same ? YOU DON'T KNOW WHAT THE METHOD(Dosomething()) DO. What we know both exception was not utilized as such.

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    We all know that managed .Net exception are derived from Exception class. If you are asking why the rest of derived Exception such as socketexception, Dbexception are created then that is another question. And it won't be necessary to allow multiple catch statement block from the compiler. Off course if you leave/comment out the above socketexception then the error definitely go to exception block, b/c of the reason that I stated above. Onething sure to know here, you can't determine to refactor the code by looking that code only, even we don't know either a SocketException will occur or not. G. Day

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    They don't occur exactly with the same reason. Off course both catches exception but how each one will occur determine by the actual method logic. Suppose Dosomething() has DB process, then where you will think possible to be catched if error happens. On catch (Exception ex) block and where do you think the socket error will be catched on (SocketException sex). That is why the method logic determine the exception occurence.

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    We can't predict looking the above code since we don't know what Dosomething() method exactly do. What we can infer is that there is a socket processing behind since there is a catch exception on it.

    The Lounge help question

  • Multiple Catch blocks that do the same thing...
    U User 11360346

    Yes it has purpose. You should see this msdn article. [^] But it wasn't utilized as suppose to.

    The Lounge help question

  • Why one .NET developer is leaving the ecosystem
    U User 11360346

    2 points. 1. Angel leaves .Net environment, who cares 2. Not everybody should be Android Dev.

    The Insider News csharp com announcement

  • The role of a senior developer
    U User 11360346

    These days a bunch of grads got a title Technical Lead, Systems Lead ... with in 6th month or less. This is v annoying and ethically wrong IMHO.Don't mention how they got the job. NO INTERVIEW(it's who you know rather than what you know).

    The Insider News csharp

  • 51% of Americans believe storms affect cloud computing
    U User 11360346

    I believe the conducted survey is based on bunch of morons. Favon.

    The Insider News com hosting cloud question announcement
  • Login

  • Don't have an account? Register

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