Skip expression bodied property in debugger

只谈情不闲聊 提交于 2019-12-10 17:18:04

问题


Is there analog of [DebuggerStepThrough] attribute available for expression-bodied properties in C# ?

For example I want to skip over the code

public Byte ByteArray => Builder.CreateArray();

[DebuggerStepThrough] can not be applied to properties. Does C# team provide any other solution in C# 6.0 ?


回答1:


DebuggerStepThrough isn't valid for expression bodied properties as this:

[DebuggerStepThrough]
public Byte ByteArray => Builder.CreateArray();

Doesn't compile. This however does:

public Byte ByteArray
{
    [DebuggerStepThrough]
    get
    {
        return Builder.CreateArray();
    }
}

There are other debugger attributes like DebuggerHidden and DebuggerNonUserCode, but they don't disable step-through.

You can disable it for all properties in the debugging options, but there's no way IMO to configure it only for expression-bodied properties.



来源:https://stackoverflow.com/questions/35035317/skip-expression-bodied-property-in-debugger

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!