if (listofelements.Contains(valueFieldValue.ToString())) { listofelements[listofelements.IndexOf(valueFieldValue.ToString())] = value.ToString(); }
Use Lambda to find the index in the List and use this index to replace the list item.
List listOfStrings = new List {"abc", "123", "ghi"}; listOfStrings[listOfStrings.FindIndex(ind=>ind.Equals("123"))] = "def";