CSharp · Console
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public void Main()
{
var John="test";
IList<Item> items = new List<Item>();
items.Add(new Item
{
tag = "{Ann}",
value = "Anny"
});
items.Add(new Item
{
tag = "{"+John+"}",
value = "Johnny"
});
items.Where(o => o.tag == "{"+John+"}").ToList().ForEach(item =>{
item.value = "jane";
});
items.ToList().ForEach(item => {
Console.WriteLine(item.tag+"="+item.value);
});
}
}
public class Item{
public string tag {get;set;}
public string value {get;set;}
}