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 7704991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:47:49+00:00 2026-05-31T23:47:49+00:00

I have a List<NameClass> that stores a collection of NameClass items with a property

  • 0

I have a List<NameClass> that stores a collection of NameClass items with a property called Name in the class. What I’m trying to do is write a Linq query that will pull all the names that start with Jones, but only if there are 3 or more occurrences. For example, if my list had the following items:

Name
-----------
Jones
Jonestown
Smith
Hector
Jones
Smith
Smith

I am looking for a C# function that I can call like this:

GetNames("Jones");

And it should return:

Jones
Jonestown
Jones

And if I run this:

GetNames("Smith");

It should return:

Smith
Smith
Smith

And if I run this:

GetNames("Hector");

It should return nothing since Hector isn’t in the list 3 or more times.

Any help writing this LINQ query would be appreciated!

  • 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-31T23:47:50+00:00Added an answer on May 31, 2026 at 11:47 pm
    string searchString = "Jones";
    string lowerSS = searchString.ToLower();
    
    List<NameClass> nameClasses; 
    
    var results = nameClasses.Where(nc => nc.Name.ToLower().StartsWith(lowerSS));
    
    if(results != null && results.Count() >= 3)
    {
        return results;
    }
    else
    {
        return null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a few Django models that look like this: class City(models.Model): name
I have List collection that is populated in specific order (the requirement is that,
I have three classes: Class A { string name IList<AB> list } Class B
I have list of groups: <select multiple=multiple name=groups[] id=groups[] class=myclass> <option value=1>Employee</option> <option value=2>Suppliers</option>
I have a class object that stores some properties that are lists of other
i have list of rows that user select and i want to delete them,
I have list of words. I type in a word misspelled. Can I query
I have Django model that looks like this: class Categories(models.Model): Model for storing the
I have models like this class Blog(models.Model): name = models.CharField(max_length=100) tagline = models.TextField() def
Suppose I have the following object: class Foo(object): def __init__(self, name=None): self.name = name

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.