我没有收到任何编译错误,除非我试图将默认的 开关添加到开关2或3。 我是嵌套太深,或者我是否需要以特殊的方式调用深层嵌套的开关? 如果这在C#中都很好用,那么我需要在代码中更难找到错误 。Can switch statements be nested?I''ve got a large routine that runs off of a switch statement.If one of the switches in switch #1 is true, that enters switch statement #2.Some of the statements in switch #2 enter a 3rd switch.I don''t receive any compile errors except whenever I attempt to add defaultswitches to switches 2 or 3.Am I nesting too deep, or do I need to call the deeply nested switches in aspecial way?If this is all fine and dandy in C#, then I need to look harder for errorsin my code.推荐答案 8月8日,12:46 * pm, jp2msft< jp2m ... @ discussion.microsoft.comwrote:On Aug 8, 12:46*pm, jp2msft <[email protected]: 可以嵌套切换语句吗? 我'有一个很大的例程,用一个开关语句。 如果其中一个开关我n开关#1为真,进入开关语句#2。 开关#2中的一些语句进入第三开关。 除非每次尝试将默认的 开关添加到开关2或3,否则我不会收到任何编译错误。 我是否嵌套太深,或者我是否需要以特殊的方式调用深度嵌套的开关? 如果在C#中这一切都很好用,那么我需要更加努力我的代码中的错误 。Can switch statements be nested?I''ve got a large routine that runs off of a switch statement.If one of the switches in switch #1 is true, that enters switch statement#2.Some of the statements in switch #2 enter a 3rd switch.I don''t receive any compile errors except whenever I attempt to add defaultswitches to switches 2 or 3.Am I nesting too deep, or do I need to call the deeply nested switches inaspecial way?If this is all fine and dandy in C#, then I need to look harder for errorsin my code. 我会以这样的方式重构每个开关盒调用 方法。它使代码更易于阅读Hi,I would refactor that in such a way that each switch case call amethod. It makes the code more simple to read开始寻找 " jp2msft" < jp ***** @ discussion.microsoft.com写信息 news:28 *********************** *********** @ microsof t.com ...start looking"jp2msft" <jp*****@discussions.microsoft.comwrote in messagenews:28**********************************@microsof t.com... 可以嵌套切换语句吗? 我有一个大的例程,它运行一个switch语句。 如果#1开关中的一个开关为真,那就进入switch语句 #2。 开关#2中的一些语句进入第三个开关。 我不是收到任何编译错误,除非我试图添加 默认 切换到开关2或3. 我是否也嵌套我需要打电话给深层嵌套开关 a 特殊方式? 如果这一切都很好,花花公子在C#中,然后我需要更加难以找到错误 在我的代码中。Can switch statements be nested?I''ve got a large routine that runs off of a switch statement.If one of the switches in switch #1 is true, that enters switch statement#2.Some of the statements in switch #2 enter a 3rd switch.I don''t receive any compile errors except whenever I attempt to adddefaultswitches to switches 2 or 3.Am I nesting too deep, or do I need to call the deeply nested switches inaspecial way?If this is all fine and dandy in C#, then I need to look harder for errorsin my code. LOL。好的。 " gerry"写道:LOL. Ok."gerry" wrote: 开始寻找start looking 这篇关于嵌套切换语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-22 16:39