I have a module in VB.NET, which is called Math.vb and in that module, I created a function The second number of a number that represents per percent I have a sub which calls the function and I call everyone from my Form 1 class. Is there any benefit / disadvantage to insert a function in the class or module?
It all depends. Modules in VB.net are basically similar to static classes, but you do not have to present method names in a module with "module name".
This module has the "relevance" function which is of very normal nature and that does not belong to any existing class. Your "percent" function might fit in this category. On the other hand, if you make a class that represents the numbers that you are computing for a percentage, and that method of that class was going to be a "percent" job, depending on that number Percentage which is defined in class instances, then, yes, I used to put the function in a class.
And in the end, if the percentage of the function would only mean the form 1 class, then I would make a personal ceremony in that class.
For the methods, you usually want to implement the most restrictive opportunity.
Comments
Post a Comment