How do I do to improve my coding ability with VS2019 C# + winform.
source link: https://www.codeproject.com/Questions/5317013/How-do-I-do-to-improve-my-coding-ability-with-VS20
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Input Two Any Value With Int Type, Call Them 'A', 'B'. User Can Input A Positive Value For How Many Times The System Creates A Random Number 'M' , A <= M < B. The System Will Create Random Number 'M' Between 'A' And 'B'. The Winform Calculates Random Number's Result And Show Them Out.
Hi All, I Create A Bad Coding. Although It Can Work, But The Processing System Struct Was Horrible.
How Do I Do To Improve My Coding Ability. If Anyone Can Help And Give Me Some Suggestions Or Through Direction.
I Need To Fix My Code To More Clean, Readability.How I Start My Coding Let The Winform Become More Completely. Thanks Guys.
GitHub - worldpeaceend/RandomNumber: input two any value with int type, call them a, b.[^]
What I have tried:
The Exam Need To Use List<List<int>>, And Dictionary<int, int> To Finish. I Can Not Totally UnderStand How To Use 'Key' And 'Value' Of List And Dictionary. At First, I Try To Use Array To Finish The System Function. But The Winform Become More And More Terrible.
List<int>
to hold the random numbers as you generate them. You can then use that list to populate a ListBox
on your form to display all the generated values.Lists don't have "Key" or "Value" - dictionaries do because they store two bits of information: a Key which must be unique and a Value which is associated with that key.Quote:I Can Not Totally UnderStand How To Use 'Key' And 'Value' Of List And Dictionary.
For example, a
Dictionary<int, Product>
might use the ProductID as the Key and the Product itself as the Value: then you use it by supplying the ID Key and acess the Product from that:string desc = products[prodID].Description; int stockLevl = products[prodID].InStock;A List doesn't do that: it just stores the Products and allows you to access them by index:
for (int i = 0; i < products.Count; i++) { Console.WriteLine($"{products[i].Description}: {products[i].Instock}"); }
To be honest, if you don't understand the difference between a Dictionary and a List, then that probably explains why your code is low quality - you need to learn the basics and get them down pretty solidly before you start coding complicated apps.
We can't tell you how to improve code we haven't looked at - and I'm certainly not bouncing off to GitHub to look through a whole app to work out what you did so badly - so I'll just say it again: learn the basics well. Until they are instinctive, you can't build good code on top of them.
Add your solution here
Preview
Existing Members
...or Join us
Your Email Password
Your Email Optional Password
Please subscribe me to the CodeProject newsletters
- Read the question carefully.
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
- If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
- Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK