C#: Equivalent of the python try/catch/else block

后端 未结 10 2619
陌清茗
陌清茗 2021-02-15 10:53

In Python, there is this useful exception handling code:

try:
    # Code that could raise an exception
except Exception:
    # Exception handling
else:
    # Cod         


        
10条回答
  •  感情败类
    2021-02-15 11:09

    that would be the empty statement like hits

    try 
    { 
        somethingThatCanThrow(); 
    } 
    catch(Exception ex) 
    { 
        LogException(ex); 
        return;
    } 
    ContinueFlow();
    

提交回复
热议问题