How can i improve this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5
19th Mar 2019, 5:39 AM
Yadiel Estrada
Yadiel Estrada - avatar
3 Answers
+ 1
Also, indentation... See Microsoft C# syntax convention.
17th May 2019, 7:36 AM
Jonas
Jonas - avatar
+ 3
1 - Try to avoid statics. 2 - Learn about Dictionary.TryGetValue and cache it instead of using lots of dictionary index access 3 - Why tolower and toupper? use only toupper 4 - Try to don't use pre-defined properties, use constructors. Also, take a look at resharper, it's a tool who can help you to code better :)
20th Mar 2019, 10:48 PM
Paulo Victor Lund de Sá Villela
Paulo Victor Lund de Sá Villela - avatar
+ 1
C# is an OOP language so it's a good starting point models some classes. For example you can create a Shop class that contains a collection of Item (another class) and expose methods like GetItems, BuyItem, RestockItem and so on. This items may have various properties like Name, Price, Stock. Play with objects and as already Paulo told to you try to avoid statics.
21st May 2019, 9:34 PM
Eymerich