icomparer Questions
3
Solved
Ive been trying to get OrderBy in a LINQ statement to work with an anonymous object but have failed by now.
I checked these already:
Anonymous IComparer implementation
C# linq sort - quick way of ...
2
Solved
I have a collection of strings in c#, for example;
var example = new string[]{"c", "b", "a", "d"};
I then with to sort this, but my IComparer method is not working, and looping infinitely by the...
2
Solved
The documentation for Sort says that Sort will throw an ArgumentException if "The implementation of comparer caused an error during the sort. For example, comparer might not return 0 when comparing...
4
Solved
If I pass in a custom IComparer to an instance of a List's Sort() method, will the comparer's Compare(x,y) method ever be called with the same item?
ie. Is it possible that Compare(x,x) may be ca...
1
I was wondering if there is possibility to use singleton as comparerObject in for example Distinct ??
Let's say that I have a list of element and I need to use distinct function on that list. Norm...
4
Solved
I'm trying to write a generic object comparer for sorting, but I have noticed it does not handle the instance where one of the values it's comparing is null. When an object is null, I want it to tr...
3
Solved
I would like to know what is better to use.
IComparer class and Compare method for sort or LINQ orderby on List. Both works fine but which one is better for large lists.
4
Solved
I have a question with whether or not this is a standard for using IComparer in C#. Say I have a situation in which there are three Person objects: P1, P2, and P3. Say I call the Compare method pas...
2
Solved
I am having difficulties to use my custom IComparer for my SortedDictionary<>. The goal is to put email addresses in a specific format ([email protected]) as the key, and sort by last name....
Knesset asked 27/4, 2010 at 9:22
5
Solved
This questions involves 2 different implementations of essentially the same code.
First, using delegate to create a Comparison method that can be used as a parameter when sorting a collection of o...
Grotesquery asked 21/3, 2010 at 18:56
3
Solved
The CompareTo() method for my class is dynamic, and can range from a simple comparison to comparisons on a number of columns. This is all determined at run time, and it works great.
But in some ca...
Marc asked 9/3, 2010 at 23:24
5
Solved
I have a list of an object which need to be sorted depending on three different properties of the object.
Example
CLass Object1{ Property1 , Property2, Property3}
ListObj = IEnumerable<Object1...
3
Solved
I have a List<MyObj> with the class MyObj : IComparable. I wrote the method CompareTo in the MyObj class per the IComparable interface, but when I use the List<MyObj>.Contains(myObjInst...
Subtractive asked 2/7, 2009 at 19:51
7
Solved
First of all, I do know about the Fisher-Yates shuffle. But lets say for arguments sake that I want to allow the user to pick a sort option from a Dropdown list. This list would include a "Random" ...
© 2022 - 2024 — McMap. All rights reserved.