Tutorial :CodeDOM: Adding DebuggerStepThroughAttribute to property



Question:

I know how to add a DebuggerStepThroughAttribute to a method or a constructor, usually you add it to the CustomAttributes collection of a code member. But I don't see a way to do this for the setter and getter of a C# property, because neither of them provides this collection where you add the attributes. Does anyone have a clue?


Solution:1

The DebuggerStepThroughAttribute is targetted at methods, constructors, structs and classes. It cannot be applied to fields or properties. You can, however, use DebuggerNonUserCodeAttribute to achieve a similar aim.

That said, attributes can be applied to CodeMemberProperty. The documentation states that it inherits CustomAttributes from the CodeTypeMember base class.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »