测试半天,原来是因为这个原因。下面例子中,Result:=''必须写,否则其结果会被累计,真是昏倒!!
function MyPaths(tache: IXMLTaskType) : String; var i: integer; begin result := ''; for i := 0 to task.paths.Count - 1 do begin if task.paths.path[i].folder<>'' then result := Result + task.paths.path[i].folder+#13; end; end;