15,892,575 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 14224038 (Top 15 by date)
Member 14224038
19-Apr-24 3:49am
View
OK so i should add string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" & will do c-1 thanks
Member 14224038
12-Apr-24 10:13am
View
ah sorry
thanks for the answers guys but i think it wont work when i have multiple objects of same type
So my primary array is like below
(cmp1.name, nut)
(cmp2.name, bolt)
(cmp1.name, nut)
(cmp3.name, washer)
(cmp1.name, nut)
(cmp1.name,nut)
(cmp3.name, washer)
I can have the key & I can have mulitple values in arraylist again & when i say below
if (!uniqueComp.TryGetValue(cmp1[i].name, out List<object> list))
{
list = new List<object>();
uniqueComp.Add(cmp1[i].name, list);
}
there will be new list & delete already old entry for cmp1.name (key) ?
SO i am looking to group nut, bolt, washer in above case.
So the output would be like
(key(cmp1.name, list of(nut)x4))
(key(cmp2.name, list of(bolt)x1))
(key(cmp3.name,list of(washer)x2))
Member 14224038
12-Apr-24 10:13am
View
thanks for the answers guys but i think it wont work when i have multiple objects of same type
So my primary array is like below
(cmp1.name, nut)
(cmp2.name, bolt)
(cmp1.name, nut)
(cmp3.name, washer)
(cmp1.name, nut)
(cmp1.name,nut)
(cmp3.name, washer)
I can have the key & I can have mulitple values in arraylist again & when i say below
if (!uniqueComp.TryGetValue(cmp1[i].name, out List<object> list))
{
list = new List<object>();
uniqueComp.Add(cmp1[i].name, list);
}
there will be new list & delete already old entry for cmp1.name (key) ?
SO i am looking to group nut, bolt, washer in above case.
So the output would be like
(key(cmp1.name, list of(nut)x4))
(key(cmp2.name, list of(bolt)x1))
(key(cmp3.name,list of(washer)x2))
Member 14224038
26-Mar-24 10:12am
View
that i can see is already there in reference, i will try more thanks
Member 14224038
26-Mar-24 9:55am
View
Ok i try to debug i got below error after it goes below line
List<int> keysToRemove = counts1.Keys.Except(duplicateKeys).ToList();
Could not load file or assembly 'Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'
Member 14224038
26-Mar-24 9:39am
View
yes something like this but above code doesnt work i dont know if i need groupby method anymore. but i need at last list of keyvalues where values are duplicate array of double, sorry for all this mess but thanks for helping me out
Member 14224038
26-Mar-24 9:08am
View
Just wondering if you can help me to filter this list ?to keep only duplcate values ? am checking count1.remove() it says remove values with specified key so should i loop above values & check all 6 array elements & use this method ?
Member 14224038
26-Mar-24 9:04am
View
yes it works now thanks it was my mistake
Member 14224038
26-Mar-24 8:57am
View
ohk & what will be best way to get filtered list of count1 with only repitative elmenets, i mean the one which is not repitative (double array)can be filtered out
Member 14224038
26-Mar-24 8:49am
View
but do i need to call Gethashcode or bool methods externally or below line is enough
var duplicateValues = counts1.GroupBy(x => x.Value, new ArrayEqualityComparer<double>()).Where(x => x.Count() > 1);
Member 14224038
26-Mar-24 8:35am
View
Doesnt work for me with below numbers
27.1879476277225 37.5134291710464 73.6017562082174 93.0498965871104 90.6893190757005 181.946376092798
27.1879476277225 37.5134291710464 73.6017562082174 93.0498965871104 90.6893190757005 181.946376092798
-25 54 -52 25 104 48
I debug the code it goes inside the sealed class & returns from below
public ArrayEqualityComparer()
{
_elementComparer = EqualityComparer<t>.Default;
}
it doesnt go inside gethashcode or bool methods ?
Member 14224038
26-Mar-24 7:23am
View
Sorry my bad they are like this,
-9.612082126422081 , 9.85084780849275 , 1.72046214901615 , 6.24986683296587 ,3.026737713146816, 0.065082033597
-9.612082126422081, 9.85084780849275 , 1.72046214901615 , 6.24986683296587, 3.026737713146816, 0.065082033597
-3.21208212642211, 2.26084780849275 , 1.72046214901615 , 9.24986683296587, 2.026737713146816, 0.065082033597
so first & 2nd are exact match. Maybe if i can round upto 4 decimal places will it work then ?Å
Member 14224038
26-Mar-24 6:08am
View
my double values are like below
-9.6120821264220819.850847808492751.720462149016156.249866832965873.0267377131468160.065082033597
-9.612082126422119.850847808492751.720462149016156.249866832965873.0267377131468160.065082033597
-2554-522510448
so here first & second are same & list should filtered with these two.
when i try to debug
from here
var duplicateValues = counts1.GroupBy(x => x.Value, new ArrayEqualityComparer<double>()).Where(x => x.Count() > 1);
it goes to here
public ArrayEqualityComparer()
{
_elementComparer = EqualityComparer<t>.Default;
} it is returned as null as a filtered list in duplicateValues variable
Member 14224038
26-Mar-24 4:07am
View
Hi richard, dont know while debug i can only see instance of public ArrayEqualityComparer()
{
_elementComparer = EqualityComparer<t>.Default;
} being called, but the methods bool Equals & GetHashCode are not called, sorry am pretty new to c#
Member 14224038
25-Mar-24 8:50am
View
thanks a lot for the code, but it doesnt workout for me. dont know why
while debug itonly goes to public ArrayEqualityComparer()
{
_elementComparer = EqualityComparer<t>.Default;
}
& return back with null. my double values have array of 6.
Show More