I create a utility method GetServiceTicketNumber()inside the utility class, since the method will be used often, I do not want to instantiate each time, so I made the method and _ticket as static.
UtilityManager also contains several other methods.
My question is:
1) Is this implemented correctly?
2) whether it is necessary to make UtilityManageralso a static class / not ?, what difference?
3) Is the code below (for the TicketProvider function) written in a singleton template? (Given that most of the singleton class creates an instance of the same class UtilityManager.)
other information: a class called in an Asp.Net application
public sealed class UtilityManager
{
public static readonly TicketProvider _ticket = new TicketProvider();
public static int GetServiceTicketNumber()
{
return _ticket.GetTicket();
}
}
source