Share via

How to delete missing element. 'Linq'

Mansour_Dalir 2,036 Reputation points
2023-06-25T19:25:02.61+00:00

hi

If possible, thank you in two different ways

        Dim ArrayMain As String() = {"A", "B", "C", "D","P","R"}
        Dim ArrayFilter As String() = {"C", "B", "V", "D","Z"} 'V & Z is Not In ArrayMain  must be removed
        Dim ArrayResult As String() = {"C", "B", "D"} ' Output
Developer technologies | VB
0 comments No comments

Answer accepted by question author

Jiachen Li-MSFT 34,241 Reputation points Microsoft External Staff
2023-06-26T03:19:28.55+00:00

Hi @Mansour_Dalir ,

You can refer to the following code, using Intersect.

        Dim ArrayResult = ArrayFilter.Intersect(ArrayMain).ToArray()

Best Regards.

Jiachen Li


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.