Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7612169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:50:33+00:00 2026-05-31T01:50:33+00:00

I am a bit new to linq, I am only using linq for filtering

  • 0

I am a bit new to linq, I am only using linq for filtering the data. Now, I want to write a query for the below:

For Each k As String In con.Numbers.Keys
      con.Numbers(k).Primary = False
Next

Con.Numbers is a dictionary, but now I converted it into a list, hence the above code wont work with list, could you please tell me how I can achieve it with Linq is the Con.NUmbers is a list. Thank you.

Additional Info:
Class Structure is :

Public Class ContactCon
        Property ConId As String
        Property ConRowID As String
        Property Title As String
        Property Mob1 As String
        Property Mob2 As String
        Property Land1 As String
        Property Land2 As String
        Property Email1 As String
        Property Email2 As String
        Property Fax1 As String
        Property Fax2 As String
        Property Primary As Boolean
        Public Sub New()
            ConId = ""
            ConRowID = ""
            Title = "Contact1"
            Mob1 = ""
            Mob2 = ""
            Land1 = ""
            Land2 = ""
            Email1 = ""
            Email2 = ""
            Fax1 = ""
            Fax2 = ""
            Primary = False
        End Sub
End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:50:35+00:00Added an answer on May 31, 2026 at 1:50 am

    Don’t know if I have misunderstood you somewhere.

    Not sure why you want to use LINQ specifically. This is perfectly clear:

    For Each number as ContactCon In con.Numbers
        number.Primary = False
    Next
    

    If for some reason you want LINQ-like syntax, you could use the List(T).ForEach:

    con.Numbers.ForEach(Sub(n) n.Primary = False)
    

    For course, this is not “real” LINQ, but again, I’m not sure why it would matter.

    If you are really forced (?) to use LINQ, you might do:

    con.Numbers.Select(Sub(n) n.Primary = False).ToList()
    

    But of course the code is nonsense. Don’t do this — stick to what is clear and obvious, which in this case means just looping over the list.

    EDIT

    Fixed terrible misuse of Function

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Still a bit new to Linq. This is driving me nuts. I want to
I am a bit new to Perl, but here is what I want to
I am a bit new to LINQ, here is my problem. I have a
I am using the new WPF toolkit's Chart to plot large data sets. I
I am a bit new to LINQ and to Entity Framework, so rather simple
I'm fairly new to linq and wanted to delve in a bit deeper by
I'm having a bit of issue converting the following t-sql statement to Linq (using
I have started using Linq to SQL in a (bit DDD like) system which
A bit new with WPF...It seems like not matter what I change with horizontal
I'm a bit new to WCF and I don't think I completely understand what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.