以下是我编写的代码。我需要修改rr
中提供的内容例如:
if rr.ThenAction = "this.MacroLoop.Current.Strategy.SubStrategy.Current.Block.AIN.HLOP = 0"
我需要将其修改为
"rr.ThenAction = "this.MacroLoop.Current.Strategy.SubStrategy.Current.Block.AIN.HLOP = 1"
if (!ruleSet.Validate(rv))
{
List<System.Workflow.Activities.Rules.Rule> rulesList = new List<System.Workflow.Activities.Rules.Rule>();
rulesList = ruleSet.Rules.ToList();
foreach (System.Workflow.Activities.Rules.Rule rr in rulesList)
{
// I need to modify the content in rr
}
}
非常感谢帮助。
答案 0 :(得分:0)
我不确定,但你在寻找类似的东西;
rulesList = ruleSet.Rules.ToList();
for (int i = 0; i < rulesList.Count; i++)
{
rulesList[i] = "sddfs";
if(rulesList[i].ThenAction == "this.MacroLoop.Current.Strategy.SubStrategy.Current.Block.AIN.HLOP = 0")
{
rulesList[i].ThenAction = "this.MacroLoop.Current.Strategy.SubStrategy.Current.Block.AIN.HLOP = 1";
}
}
希望它有所帮助...... !!!
PS:如果你打算在foreach中更改rr的值,那么它将无法工作,因为foreach是一个只读迭代器,它动态迭代实现IEnumerable的类,但你可以使用item.value进行更改。