question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for ILookup<,>

See original GitHub issue

We recently added built-in support for IReadOnlyList<> (#941), IReadOnlyDictionary<,> (#980) and ISet<> (#983).

The one left out is ILookup<,>.

Unluckily this is a tricky one because there is only one implementation (Lookup<TKey, TValue> and this one has no public constructor.

I have a working customization for a closed generic form but I wonder if it can be reimplemented so that it works for open generics and then can be added to the default registration.

fixture.Customize<ILookup<string, int>>(c => c.FromFactory((IDictionary<string, IEnumerable<int>> input) => input.SelectMany(i => i.Value, (item, value) => new { key = item.Key, value }).ToLookup(k => k.key, v => v.value)));

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
zvirjacommented, Mar 5, 2018

@moodmosaic Thanks for your thoughts, they confirmed my initial intention 😃

@Kralizek Given that there is a relatively simple way to enable this feature in your solution, would you be fine if we close this issue for now? If later there are more requests for it, we could re-open it again.

0reactions
zvirjacommented, Mar 5, 2018

Well, it’s impossible to remove issues from GitHub. Even after I close it, you can still find it using the Search and use the code sample above.

Therefore, you will have ages to copy the sample above 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

ILookup<TKey,TElement> Interface (System.Linq)
Defines an indexer, size property, and Boolean search method for data structures that map keys to IEnumerable<T> sequences of values.
Read more >
How to return ILookup directly (without using a Dictionary- ...
I'm not entirely sure why you have the dictionary in the first place. Does this work for you? return query.ToLookup(clause => clause.
Read more >
Mail - Official Apple Support
Mail Settings Lookup. Enter your email address below and we will verify your Mail settings. Email Address.
Read more >
ILookup Interface
The basic lookup interface that allows for retrieving implementations for different aspects of the current instance. Namespace: yWorks.Support
Read more >
Support for lookup codes
The Sterling Configurator Visual Modeler uses lookup codes to provide a mechanism for maintaining and displying locale-specific strings to users.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found