If I have class with static field:
And I have list type of this class:Code:public class Cart { private static int quantity_all_books = 0; public int id { get; private set; } public int quantity { get; private set; } public Cart(int x, int y) { quantity_all_books++; id = x; quantity = y; } }
How can I check value static field quantity_all_books. I have tried make this field public, write method which return value of this field. But when I write "shopping." Visual Studio don't give me on the list this field or method.Code:List<Cart> shopping = new List<Cart>(); shopping.Add(new Cart(53, 2)); shopping.Add(new Cart(44, 1));




Reply With Quote