Похожие чаты

Please tell me how to shorten it? studentCounter counts how

many student IDs have passed, you need to pull out the next groupId for every 3 students

12 ответов

18 просмотров

oh god...

Seems like rules pattern is applicable here

look, I don’t know C#, I’m a Go’pher so please excuse me for sharing Go code but that is the fastest I can help: https://play.golang.org/p/R4H55fbkVcb 1. the code you wrote is terrible because you hardcoded all rules, which is really really bad. You want rules to be dynamically configurable. 2. you just iterate over a sorted (by max student count) list of rules until you pick one that suits the number at hand.

few notes here..... 1. groups is an unsorted list. Who knows what order they'll be in when you get them. Also, List().ToList()... what? 2. if you simply need to group 3 students at a time, use math var groupNumber = (studentNumber / 3) + 1 example: student 10, divide by 3 = 3, plus 1 = 4, this student is in group 4. 3. Group size should be a configurable variable, as @Romshark was saying, hardcoding = bad. 4. what the heck is going on in that for loop? Barring all of that, could you instead tell us what the expected end result is?

Another thought, you are assuming there are enough groups to handle the number of students it seems. If I only have 3 groups and send 20 students in, that's going to be an issue. You need to handle that.

Roman Sharkov
look, I don’t know C#, I’m a Go’pher so please exc...

OT, i love the fact that go as has its own "playground"

getAx
OT, i love the fact that go as has its own "playgr...

we also have a more advanced playground for analyzer and nuget developers https://sharplab.io/

getAx
Nothing official tho

There's also https://try.dot.net/

Shafiq Jetha
There's also https://try.dot.net/

That looks official, never seen it before

getAx
That looks official, never seen it before

Yep. It was released maybe 9 or 10 months ago.

Похожие вопросы

Обсуждают сегодня

This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
а через ESC-код ?
Alexey Kulakov
29
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
есть ПО, которое лежит папкой, по сути и не инсталится, а просто запускается. Надо раскидать по машинам в домене. Я так понял, что прям настройками GPO, копировать я смогу тол...
Dmitriy
8
any reference of this implementation?
BitBuddha
29
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
Привет)) уже кажется эту тему перемусолили, но вот я так и не понял. Я сейчас сижу на 27дюймов 2к мониторе. На Актуальной макоси, если я куплю 27д 4к монитор: - будет ли изобр...
Vladislav Piskunov
16
Карта сайта