The DebuggerStepThrough
attribute instructs the VS debugger to step through code instead of stepping into the code.
DebuggerStepThroughAttribute Class
My question is, is there an equivalent of this attribute to use it for a Property
member?, because the setter of my property can throw an exception, and I don't want to break in the setter's code-block when that happens.
I know one solution is to move the setter's code to a single method and then set the DebuggerStepThrough
attribute to that method, but I'm just asking for a possible alternative applying another attribute instead of moving code.
You can actually apply this attribute directly to the getter and setter.
Dim firstName, lastName As String
Property fullName() As String
<DebuggerStepThrough>
Get
If lastName = "" Then
Return firstName
Else
Return firstName & " " & lastName
End If
End Get
<DebuggerStepThrough>
Set(ByVal Value As String)
Dim space As Integer = Value.IndexOf(" ")
If space < 0 Then
firstName = Value
lastName = ""
Else
firstName = Value.Substring(0, space)
lastName = Value.Substring(space + 1)
End If
End Set
End Property
This is the same for C#.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With