With LinkedList<T> you work with LinkedListNode<T> elements. LinkedListNode<T> has a Value property that you can use to get or set a specific item.
Unlike C #, Java has no concept of properties integrated into the language. In Java, you create properties by adding the set_Property and get_Property methods manually. C # properties can be accessed as fields.
Java:
obj.set_MyProperty(123); x = obj.get_MyProperty();
WITH#:
obj.MyProperty = 123; x = obj.MyProperty;
Inside, however, C # calls the getter and setter methods. You would declare a property like this in C #:
private int _myProperty; public int MyProperty { get { return _myProperty; } set { _myProperty = value; } }
In this special case, when no other logic is involved, you can use the automatically implemented properties:
public int MyProperty { get; set; }
In your linked list, you change the frst element from the list as follows:
myLinkedList.Fist.Value = your new value;
source share