Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I agree with zeencat 100%. The only way to trully learn something is by self discovery. Doing this will allow you too pick up many additional unknown pieces and best practices along the way. Your code does not look 'that bad' given that you mentioned you're a beginner, however I do notice a few things you should take notice of in your class:</p> <p>To name one example: your class attributes (public string companyName;) should never be public, as this allows the end user to purposely or unintentionally break the code. These fields should always be private. Additionally, it's usually good practice to use Hungarian Notation when creating class attributes and including an underscore to denote the fields accessor status (public, private, etc.)</p> <p>eg. _strCompanyName; or _strMSRP; </p> <p>Doing it this way lets you know that this is a private string variable. When you look over your code to debug it later (as zeencat pointed out) it would have been much easier to spot the 'type mismatch' with _strmMsrp;</p> <p>Lastly, it is always good to initialize your variables once you've declared them: </p> <p>eg. string myString = ""; or double myNumber = 0.0; or bool isTrue = true; etc. </p> <p>Here is a link to tutorial series for C# fundamentals which I used to get started. After 3 years they are still the best I've seen. Every lesson taught, and every example given, are industry best practices. </p> <p><a href="https://www.youtube.com/watch?v=SXmVym6L8dw&amp;list=PLAC325451207E3105" rel="nofollow noreferrer">c# tutorial for beginners</a></p> <p>Best of luck to you. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload