Published: Thursday 12 October 2023
Static classes work in the same way as classes apart from one fundamental difference. They cannot be initalised.
Essentially, you are not able to use the new
operator on a static class.
Learn more about static classes and class members from the Microsoft website.
We have this static CategoryHelper
class.
public static class CategoryHelper
{
public static List<int> GetAllCategoryIds()
{
return new List<int>();
}
}
If we wanted to call the GetAllCategoryIds
method, how would we do it?