[英]Can I set a breakpoint in an inline if in Visual Studio and C#?
Can I set a breakpoint like below (the asterisk symbolises the breakpoint dot)? 我可以设置如下的断点(星号表示断点)吗?
var x = ifThis ?
* This() :
That() ;
Environment is C# and Visual Studio 2015. 环境是C#和Visual Studio 2015。
( I just told a colleague that I was possible but seem to stand corrected ) ( 我刚告诉一位同事,我有可能,但似乎有所纠正 )
You can only place the breakpoint in the whole line. 您只能将断点放在整行中。
However, you can: 但是,您可以:
Press F11
while debugging to enter the line and see which function was hit; 在调试时按
F11
进入该行并查看被击中的功能;
Add a conditional breakpoint so it will only break in the specified conditional; 添加条件断点,使其仅在指定的条件中断开; This is the closest of what you want, and have no practical difference on setting the break point on only one part of the expression, other than the full line being marked in VS.
这是你想要的最接近的,除了在VS中标记的整行之外,在表达式的一部分上设置断点没有实际区别。
To add a conditional breakpoint, first set the breakpoint, then right click the red dot on the left -> "Condition..." 要添加条件断点,首先设置断点,然后右键单击左侧的红点 - >“条件...”
Visual Studio sees this as a single line and the breakpoint will show as being on all 3 lines. Visual Studio将此视为单行,断点将显示为在所有3行上。 You cannot set it on a single line in an inline if statement.
您不能在内联if语句中将其设置在单行上。
Sorry! 抱歉!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.