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

  • Home
  • SEARCH
  • 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 8724715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:53:13+00:00 2026-06-13T07:53:13+00:00

I am using linq to search product in ObservableCollection, but it does not return

  • 0

I am using linq to search product in ObservableCollection, but it does not return any result, for example I have a product name “stack”, but when I search “s”, it return no result:

private ObservableCollection<Product> _ProductList = new ObservableCollection<Product>();

public ObservableCollection<Product> ProductList 
 { get { return _ProductList; } set { _ProductList = value; } }

I have a textbox, when user type, linq will search product name in the ObservableCollection:

private void productSearch_KeyUp(object sender, KeyEventArgs e)
{
      // Search text
      string productSearchText = productSearch.Text.Trim(); 

      // Search product, return no result
      var search = ProductList.Where(s => s.Name.StartsWith(ProductSearchText));

      search.ToList().ForEach(ProductList.Add);
}

Edited:

I notice it is because of letter case problem. I needs to be in uppercase, if the product name is in uppercase, how can I search regarding of letter case?

  • 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-06-13T07:53:14+00:00Added an answer on June 13, 2026 at 7:53 am

    if the problem is in the case sensetivity you may try to use this

    s.Name.ToUppper().StartsWith(ProductSearchText));
    

    or you can try this as well

    s.Name.ToUppper().StartsWith(ProductSearchText, StringComparison.OrdinalIgnoreCase));
    

    and you probable want to use search foreach like this

    foreach(var item in search)
    {
    
        // get a search item and do what you want with it 
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using LINQ to SQL to get a search result of a FullTextSearch stored
When using linq and you have c.Sort() Is there any good inline way of
I'm trying to build a search page using LINQ to Entities, but the following
I have a search method below using linq, my search citeria is based on
I was using Linq to SQL and it didn't have any FULL-TEXT support. I
Using LINQ to Entities, how can I determine if any item from a List
Im using LINQ over DataSet but just to get data from some tables, by
When using linq to sql are there any benefits of using subsonic's active record
We have a project using LINQ to SQL, for which I need to rewrite
I have a very complex Linq to SQL query that returns a result set

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.