30 Replies
how'd u add the color
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/see the
cs
at the top?oh
thats what sets the syntax highlighting
on the same row as the backticks
didnt work
no spaces either
anyway that's what im getting
well yeah, your code only stores the single most repeated number, as far as I can tell
can we vc
ill explain it
#vc-2
i dont recommend this solution but LINQ is fun. output:
[ 5, 3, 1]
without looking at the other's solutions. Here's mine dumb one :
@Pobiega i guess ur dictionary is the only way lol
:kekw:
skill issue
you got close to mine
yeah yours was more concise and clever. I didn't think I could do this with grouping lol
well, dictionary or groupby are by far the easiest ways, yeah
you absolutely can do this with arrays, but im not sure you can do it with a singular array, in a nice way...'
LINQ is the beauty of C#. You would rarely find feature similar to LINQ in other langs lol
yesn't
most functional languages have something very similar.
ocaml, f#, haskell, gleam, rust, elm..
hell even Java with their "we have linq at home" streams api
that said, poor Alonuis is a student and his teacher has only gone through
int
and int[]
so far :p
I dont think the teacher would be very happy to see a 5-method linq chain 😄:kekw:
this had me dying
fun story, I took a university course for "intro to C#" when I already had ~ 5 years of work experience with it
well at least js doesn't have it (there are some third party libs but not built in) , so I can flex the c# LINQ
just for "free credits" so to speak
lets just say that the TAs were very sceptical before I told them I worked as a C# dev 😄
@Pobiega i fixed it
it was j=i
idk now it works
had to use a copy u cant otherwise
i love groupby, very confusing but powerfull