internal void TraverseAllArtifacts <TState>(TState state, Action <TState, Artifact> artifactAction) { Contract.Requires(artifactAction != null); // calls given action for each artifact transitively found from this compound value foreach (var val in Values.AsStructEnumerable()) { switch (val.Type) { case ArgumentValueKind.Artifact: artifactAction(state, val.Artifact); break; case ArgumentValueKind.CompoundValue: val.CompoundValue.TraverseAllArtifacts(state, artifactAction); break; } } }