0

I need to convert some C# code into VB.NET. How should the below lambda event handler be written in VB.NET?

item.PropertyChanged += Function(s, e)
                             If e.PropertyName = "SomeProperty" Then
                                  //do something
                             End If
                        End Function

Code converter tools do not provide any meaningful conversion for this.

1
  • 4
    I don't know why people are voting to close this question on the grounds that it is "unclear". It seems perfectly clear to me. Commented Apr 2, 2015 at 23:10

1 Answer 1

4

I can't say definitely since I'm not sure what the type of item is but I imagine this will work:

AddHandler item.PropertyChanged, Sub(s, e)
                                    If e.PropertyName = "SomeProperty" Then
                                       'do something
                                    End If
                                 End Sub
Sign up to request clarification or add additional context in comments.

1 Comment

I was only looking for the correct syntax here, so item can be any object that has INotifyPropertyChanged.PropertyChanged event.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.