C#Collections Shopping Cart

This is an exercise of objects and collections, the creation of objects, some basic functions of collections, such as ad...

This is an exercise of objects and collections, the creation of objects, some basic functions of collections, such as adding, editing, deleting and so on.


The object is the goods of the online shop.Insus.NET Only two attributes are added to it, the Key and name ItemName of the object's ID, and two constructors. The last method is to override the ToString() method.

class Item { private int _key; public int Key { get { return _key; } set { _key = value; } } private string _ItemName; public string ItemName { get { return _ItemName; } set { _ItemName = value; } } public Item() { } public Item(int key, string itemName) { this._key = key; this._ItemName = itemName; } public override string ToString() { return string.Format("ID: ; Name: . ",_key,_ItemName); } }
Source Code

27 May 2020, 12:24 | Views: 3625

Add new comment

For adding a comment, please log in
or create account

0 comments