C
C#2y ago
Elmishh

❔ comparing classes

I have a code that does a bit of math in a class and i want to compare 37 of these classes each having different base numbers and finding the worst and best, how can i do that
14 Replies
Elmishh
ElmishhOP2y ago
Is the only way to get a value out of those classes is have a variable outside of the classes and using it inside of them? And if it is how am i supposed to find what numbers are the biggest
Buddy
Buddy2y ago
$details
MODiX
MODiX2y ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Elmishh
ElmishhOP2y ago
What kind of details It pulls from hypixel web api, does some math and then writes some numbers
Buddy
Buddy2y ago
Do you have any examples of code? PoC
Elmishh
ElmishhOP2y ago
And then that but 37 more times for each item
Buddy
Buddy2y ago
each having different base numbers and finding the worst and best
Do you mean sorting?
Elmishh
ElmishhOP2y ago
Yeah i guess Instead of pumping out unorganized numbers to make it go from highest to lowest
Buddy
Buddy2y ago
https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.orderby?view=net-8.0 You can use this to sort a collection. If that's what you want
Elmishh
ElmishhOP2y ago
I wanna take a list of numbers and sort from biggest to smallest
Buddy
Buddy2y ago
Yes, that function will do that exact thing.
Sorts the elements of a sequence in ascending order.
blinkbat
blinkbat2y ago
MyListOfClasses.OrderByDescending(c => c.SomeNumber)
MyListOfClasses.OrderByDescending(c => c.SomeNumber)
trunksvn
trunksvn2y ago
🤓
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server