3 ms·
Not sure if it's a part of the standard library, but the .Net variant of C# contains a sorted dictionary: https://msdn.microsoft.com/en-us/library/f7fta44c(v=vs
by whoisthemachine 10y ago
Not sure if it's a part of the standard library, but the .Net variant of C# contains a sorted dictionary: https://msdn.microsoft.com/en-us/library/f7fta44c(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/f7fta44c(v=vs.110)....
- whoisthemachine 10y agoAlso, fantastic work. The readability of C# really shines through here - I could grok all of this code instantly :)
- cheatdeath 10y agoThanks. Actually organising the write up forced me to tidy up the code much more than I otherwise would have. I definitely find C# to be one of the more readable languages although I have had to debug and untangle some C# messes before. Yeah I remember changing it to a SortedDictionary but I changed it back. I can't remember exactly why, possibly because it's supposed to be sorted by raw UTF8 bytes rather than a nice neat C# string and I didn't want to start using byte arrays for dictionary keys. I guess it only needs to be sorted when in the BEncoding format and it felt better to keep the internal structure as simple as possible. The tradeoff is it doesn't support incorrectly encoded torrent files – I'm really not sure how much of an issue that is.
- kidmenot 10y agoAgreed. Properly written C# code is very readable. I write most things in it these days and couldn't be happier about what this language has become. I have a few minor gripes with id, but they mainly relate to missing syntactic sugar rather than actual shortcomings. Kudos to OP, great job. EDIT: fix up grammar mistake.