Support for ILookup<,>
See original GitHub issueWe 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:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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 😄