c# - Creating An Utilities Class? -


I am very new in OOP and using the best coding principles to make things strictly class based on my hardest I am trying.

I am a fair way in my project and I have a lot of common use methods which I want to put in the utility category. What is the best way to build utilities classes?

  public class utilities {int test; Public Utilities () {} Public int amount (int number 1, int no 2) {test = number1 + number2; } Return exam; }  

After creating this utility class, can I just create a utility object, and run the methods I like? Do I have the idea of ​​this Utility Class correct?

You can call it static class, like this:

Former> public stable class utilities {public static integer number (int number 1, int no 2) {return number 1 + number 2; }} Int three = utilities (1, 2);

The class should not (generally) be any field or property (unless you want to share an example of some object in your code, then you can get a constant can create readable properties.


Comments