c# - How To Modify LinkedList Property -
i want modify item's property before add linkedlist. item i'm going add has 2 properties:productid , productvalue this:
public class product { private byte _productid; public byte productid { { return _productid; } set { _productid = value; notifypropertychanged("productid"); } } private uint16 _productvalue; public uint16 productvalue { { return _productvalue; } set { _productvalue = value; notifypropertychanged("productvalue"); } } } now want modify item's productvalue according previous productid in linkedlist e.g. if previous.productid = 1, next.productvalue = previous.productvalue + 1 how supposed property using linkedlist<product> dll = new linkedlist<product>()? in advance!
so how can productid in linkedlist?
you can element in list using elemenat method access element in linkedlist.
using method can iterate for-loop through collection. can element this:
product previous = dll.elementat(i - 1); and access property this:
if (previous.productid == 1) this should make possible figure out rest. if still have difficulties, drop me comment
Comments
Post a Comment