The specific function of clear is to clear all the items in the specific target set. The specific usage is as follows:
1. Create an activity file, drag a sequence and addtocollection, and add a clearcollection activity:
2. Set clearcollection activity attributes as follows:
3. Next, we will add several writeline activities to identify the start and end of the WF process, and record the specific content of each operation as follows:
The above content is a bit large, so I split it, but the above images are complete together. If you cannot understand it, please referCodeRight:
4. Run F5 and check the specific running result to see if we want it. After the clearcollection activity is executed, will the set output the result?
5. For a clearer demonstration, we will add a few more addtocollection <t> activities above and add some items to the set:
6. Continue F5 and check the running effect:
7. We should have discovered that the addtocollection above is not very convenient. In actual scenarios, we may use the while loop to add nodes?
Or another loop method. Next we add elements to the set through a loop.
A. Define the myflag variable, int32 type, and sequence. You can control the number of loops.
B. Delete the original addtocollection activity. Add the while activity as follows:
C. Run F5 and check the output to see if it is the same as we thought: