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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:57:26+00:00 2026-05-12T22:57:26+00:00

I have a generic dictonary which is templated in the following manner: Dictionary<object, IList<ISomeInterface>>

  • 0

I have a generic dictonary which is templated in the following manner:

Dictionary<object, IList<ISomeInterface>> dictionary1 = new Dictionary<object,    IList<ISomeInterface>>();  

If I wanted to omit certain list items against arbitrary keys (that is the items that are in the list contained within the value part of each of the key value pairs making up the dictionary) given some arbitrary condition (lets say omitting list items where a list item contained the string “abc”)

I would expect to able to create/project into a new dictionary which would contain entries which contained lists WITHOUT those items whose name contained “abc”

How do I achieve this using a Lambda expression?

I was trying something like this:

var result1 = dictionary1.Where(x => x.Value == x.Value.Select(y => !y.contains(“abc”));

  • 1 1 Answer
  • 2 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-12T22:57:26+00:00Added an answer on May 12, 2026 at 10:57 pm

    To you want it as another dictionary? Try this:

    var result = original.ToDictionary(
        pair => pair.Key, // Key in result is key in original
        value => pair.Value  // Value in result is query on original value
                     .Where(item => !item.Contains("abc").ToList());
    

    EDIT: VB as per the comment:

    someDictionary.ToDictionary(Function(x) x.key, _ 
                Function(y) y.Value.Where(not y.Value contains("abc").ToList())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class which contains a generic dictionary: protected Dictionary<K,T> Data { get;
I have a generic collection (Dictionary), which stores an enum and delegate. So if
I have the following error message: 'System.Collections.Generic.Dictionary<int,SpoofClass>' does not contain a definition for 'biff'
I want to write in Delphi (2009 - so I have generic dictionary class)
Say that i have a generic dictionary with data like this (I hope the
I have System.Collections.Generic.Dictionary<A, B> dict where A and B are classes, and an instance
I have a class that inherits a generic dictionary and an inteface public class
I have a class that inherits from a generic dictionary as follows: Class myClass
Looking at System.Collections.Generic.Dictionary<TKey, TValue> , it clearly implements ICollection<KeyValuePair<TKey, TValue>> , but doesn't have
I have (for example) Dictionary of different generic types ( d1, d2, d3, d4

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.