惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - 生鱼片

Gitlab安装过程 SharePoint 2013即SharePoint 15的一些新特性 关于虚机克隆模板导致无法添加域用户的问题 http header Content-type SharePoint 2010 文档库中直接打开文档 使用SymbolResolver在Activity内访问宿主环境信息 增加一个Export to Spreadsheet的链接 WF4:自定义跟踪参考者 WF4:ETW跟踪参与者 SharePoint 2010 BI(2):使用Visio Service SharePoint 2010 BI (1):Chart WebPart 微软WebMatrix介绍 使用Sharepoint 2007中的webservice操作列表 - 生鱼片 - 博客园 SharePoint中CAML使用的一些总结 使用SharePoint Designer 2010 创建 外部内容类型 WF4:同步执行工作流 - 生鱼片 - 博客园 SharePoint 2010中托管元数据 SharePoint 2010中的客户端模型 SharePoint 2010中的Content Query WebPart
WF4集合Collection相关活动用法
生鱼片 · 2011-01-20 · via 博客园 - 生鱼片

集合活动用于使用工作流中的集合对象。.NET Framework 版本 4包含多个系统提供的活动,用于在集合中添加和移除项、测试集合中是否存在某个项以及清除集合。所有集合活动都是继承自 CodeActivityCodeActivity 的泛型类;ExistsInCollectionRemoveFromCollection 具有一个类型为 BooleanOutArgument,用于指示结果。主要涉及以下相关活动:

clip_image002

1.写一个自定义活动用来显示集合中的内容

public sealed class PrintCollectionsActivity<T> : CodeActivity

    {

        // Define an activity input argument of type string

        public InArgument<ICollection<T>> InCollection { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>

        // and return the value from the Execute method.

        protected override void Execute(CodeActivityContext context)

        {

            // Obtain the runtime value of the Text input argument

            ICollection<T> collection = InCollection.Get<ICollection<T>>(context);

            if (collection.Count > 0)

            {

                Console.WriteLine("---------------begin---------------");

                foreach (var item in collection)

                {

                    Console.WriteLine(item.ToString());

                }

                Console.WriteLine("----------------end----------------");

            }

            else

            {

                Console.WriteLine("Collection is empty!");

            }

        }

    }

2.在工作流中定义两个变量如下图:

clip_image004

3.设计工作流如下图:

clip_image006

4.在这个工作流中我们展示集合相关的四个活动的用法,详细的属性设置可以看上图,宿主代码如下:

class Program

    {

        static void Main(string[] args)

        {

            WorkflowInvoker.Invoke(new Workflow1());

            Console.ReadLine();

        }

    }

5.运行的结果如下:

clip_image008