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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:14:54+00:00 2026-06-01T03:14:54+00:00

Answer solved in edit below I had this piece of code Dictionary<Merchant, int> remaingCards

  • 0

Answer solved in edit below

I had this piece of code

Dictionary<Merchant, int> remaingCards = CardService.GetRemainingCardsNumber(int.MaxValue, 0).Result; 

GetRemainingCardsNumber returns Merchants object with Id and Name property , and the matching card numbers as Int .

Now , let say I want to filter the dictionary based on the Name property inside the Merchant object . I did it like this :

cardmodel.MerchantRemainingCards = from Dictionary<Merchant, int> filterRemaining in cardserv.GetRemainingCardsNumber(int.MaxValue, 0).Result
                                                   where filterRemaining.Keys.FirstOrDefault().Name.Contains(merchantNameFilter)
                                                   select filterRemaining; 

But obviously its not working because I’m not familiar with dictionary type .

— solved it here —

        cardmodel.MerchantRemainingCards = cardserv.GetRemainingCardsNumber(int.MaxValue, 0).Result
                                           .Where(e => e.Key.Name.ToLower().Contains(merchantNameFilter.ToLower()))
                                           .ToDictionary(e => e.Key, e => e.Value); 

Just cast it back to dictionary .

  • 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-01T03:14:55+00:00Added an answer on June 1, 2026 at 3:14 am

    If, as you suggest, your first bit of code does return a Dictionary then you should be able to do this:

    from KeyValuePair<Merchant, int> card in cardserv.GetRemainingCardsNumber(int.MaxValue, 0).Result 
    where card.Key.Name.Contains(merchantNameFilter)
    select card;  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: I have solved this by myself. See my answer below I have set
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
EDIT: SOLVED! answer below first code box When i try to connect with a
edit: this is now solved, see my answer below The situation: User clicks on
Update: Solved, with code I got it working, see my answer below for the
EDIT: Solved, my mistake; explained in my answer. I have this: std::vector < boost::shared_ptr
[EDIT: Problem solved. Please see my answer below.] In my app I call the
Problem solved: Thanks guys, see my answer below. I have a website running in
EDIT: I solved #2 below by simply changing the background of the TextView's parent
((Answer selected - see Edit 5 below.)) I need to write a simple pink-noise

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.