score:3
the problem is impossible, conceptually. you're trying to compare objects in a way that doesn't have a form of equality that is necessary for the operations you're trying to perform with it. for example, groupjoin
is dependant on the assumption that if a is equal to b, and b is equal to c, then a is equal to c, but in your situation, that's not true. a and b may be "close enough" together for you to want to group them, but a and c may not be.
you're going to need to not implement iequalitycomparer
at all, because you cannot fulfill the contract that it requires. if you want to create a mapping of items in one collection to all of the items in another collection that are "close enough" to it then you're going to need to write that algorithm yourself (doing so efficiently is likely to be hard, but doing so inefficiently isn't shouldn't' be that difficult), rather than using groupjoin
, because it's not capable of performing that operation.
score:1
i can't see any way to generate a logical hash code for your given criteria.
the hash code is used to determine if 2 dates should stick together. if they should group together, than they must return the same hash code.
if your "float" is 5 days, that means that 1/1/2000 must generate the same hash code as 1/4/2000, and 1/4/2000 must generate the same hashcode as 1/8/2000 (since they are both within 5 days of each other). that implies that 1/1/2000 has the same code as 1/8/2000 (since if a=b and b=c, a=c).
1/1/2000 and 1/8/2000 are outside the 5 day "float".
Source: stackoverflow.com
Related Query
- Using IEqualityComparer GetHashCode with a tolerance
- Intersect with a custom IEqualityComparer using Linq
- Using an IEqualityComparer with a LINQ to Entities Except clause
- How can I combine IObservable<T>.Throttle() with some other event source using Reactive Extensions?
- Linq sub query when using a repository pattern with EF code first
- How can I fetch child entities as DTO in parent using reusable queries/Expression's with EF code first?
- Can't add a new record with an integer value into database by using linq from code C#
- Can this be done with less code using lambda?
- Convert/Parse many Objects using a member Method with less Code
- Compiling Error with LINQ Sorting Code Using List<T>
- Intersect or union with a custom IEqualityComparer using Linq
- I need to save the XML file using linq with xml code in C#
- EF code first: using Linq with many-to-many relationship
- How to call an Sql User defined Function using Entity frame work Code first approach with LInq c#
- Convert string[] to int[] in one line of code using LINQ
- Using IQueryable with Linq
- C# - code to order by a property using the property name as a string
- How do I find the text within a div in the source of a web page using C#
- How to find item with max value using linq?
- Entity-framework code is slow when using Include() many times
- What does this C# code with an "arrow" mean and how is it called?
- Populate a list with a specific range of numbers by using LINQ
- How to handle NULL object property with FirstOrDefault using Linq
- Using Linq with 2D array, Select not found
- Using FluentValidation's WithMessage method with a list of named parameters
- How to get distinct with highest value using Linq
- Using LINQ, how do I find an object with a given property value from a List?
- Using Linq to do a Contains with multiple values
- using Linq with multiple where conditions
- How to remove an element from an xml using Xdocument when we have multiple elements with same name but different attributes
More Query from same tag
- Getting requests on which a user have answered
- How to restrict LINQ query to marketing lists of a given campaign?
- Using LINQ to surround all "group" elements with the new element "groups" in C#
- Remove a node like <nom:Hrs/> from xml with vb .net
- Linq - Casting IQueryable to IList returns null - WHY?
- How to match case-sensitive username and password
- AddMapping column to list
- Check which elements are on one list comparing to another list LINQ
- How do I parse this xml using linq?
- Compiled Linq & String.Contains
- Using Group by with x amount of elements
- conditional check in predicate LINQ
- LINQ to compare item in one list to any item in another
- Linq To Objects With DateTime Properties
- Recursive linq to get infinite children
- Query multiple databases with one query
- How to get column names from table returned from stored procedure
- Correct way of using the 'using' statement in Entity Framework
- Formatting a GroupBy result for Report
- Concat arrays at a certain index with LINQ?
- Query Parent's record where condition on a Grandchild
- Translating SQL Queries to LINQ
- How to get Values of another table using one table using LINQ
- C# how do I implement inheritance using linq?
- How to Select a grandchild element of a element using xDocument and Linq
- Issue when converting SQL to LINQ
- SQL to LINQ - left join from same table using values equal to and greater than
- LINQ - Full Outer Join
- Connect to Database with Connection String to use LINQ
- Select data from database where date in current month