10月 15

做了几个WF的小练习,为了不至于关掉visual studio就忘记了,特意记录一下

建立的是WorkFlow Console的项目

启动代码

        static void Main(string[] args)
        {  
            WorkflowApplication instance = new WorkflowApplication(new Workflow1());
            //当实例运行完成时调用的方法 
            instance.Completed = new Action<WorkflowApplicationCompletedEventArgs>(workflowCompleted); 
            //打印实例ID 
            System.Console.WriteLine(instance.Id); 
            //启动实例 
            instance.Run(); 
            System.Console.Read(); 
            Console.Read();
        } 
        static void workflowCompleted(WorkflowApplicationCompletedEventArgs e)
        { 
            System.Console.WriteLine("状态:{0}", e.CompletionState.ToString()); 
            System.Console.WriteLine("实例编号:{0}", e.InstanceId); 
        }

控制流

Parallel

并发执行,直到全部执行完再继续往下走

<Activity mc:Ignorable="sap sap2010 sads" x:Class="WFTest.WFConsoleApplication.Workflow1"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="argName" Type="InArgument(x:String)" />
    <x:Property Name="argAge" Type="InArgument(x:Int32)" />
    <x:Property Name="argMessage" Type="InArgument(x:String)" />
  </x:Members>
  <sap2010:ExpressionActivityEditor.ExpressionActivityEditor>C#</sap2010:ExpressionActivityEditor.ExpressionActivityEditor>
  <sap2010:WorkflowViewState.IdRef>WFTest.WFConsoleApplication.Workflow1_1</sap2010:WorkflowViewState.IdRef>
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Text</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Microsoft.CSharp</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>WFTest.WFConsoleApplication</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_6">
    <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_2" Text="Start" />
    <Parallel sap2010:WorkflowViewState.IdRef="Parallel_1">
      <Sequence sap2010:WorkflowViewState.IdRef="Sequence_3">
        <Sequence.Variables>
          <Variable x:TypeArguments="x:Int32" Name="variable1" />
        </Sequence.Variables>
        <While sap2010:WorkflowViewState.IdRef="While_1">
          <While.Condition>
            <mca:CSharpValue x:TypeArguments="x:Boolean">variable1&lt;18</mca:CSharpValue>
          </While.Condition>
          <Sequence sap2010:WorkflowViewState.IdRef="Sequence_2">
            <Delay Duration="00:00:01" sap2010:WorkflowViewState.IdRef="Delay_1" />
            <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_3">
              <InArgument x:TypeArguments="x:String">
                <mca:CSharpValue x:TypeArguments="x:String">"Left"+variable1</mca:CSharpValue>
              </InArgument>
            </WriteLine>
            <Assign sap2010:WorkflowViewState.IdRef="Assign_1">
              <Assign.To>
                <OutArgument x:TypeArguments="x:Int32">
                  <mca:CSharpReference x:TypeArguments="x:Int32">variable1</mca:CSharpReference>
                </OutArgument>
              </Assign.To>
              <Assign.Value>
                <InArgument x:TypeArguments="x:Int32">
                  <mca:CSharpValue x:TypeArguments="x:Int32">variable1+1</mca:CSharpValue>
                </InArgument>
              </Assign.Value>
            </Assign>
          </Sequence>
        </While>
      </Sequence>
      <While sap2010:WorkflowViewState.IdRef="While_2">
        <While.Variables>
          <Variable x:TypeArguments="x:Int32" Name="variable1" />
        </While.Variables>
        <While.Condition>
          <mca:CSharpValue x:TypeArguments="x:Boolean">variable1&lt;6</mca:CSharpValue>
        </While.Condition>
        <Sequence sap2010:WorkflowViewState.IdRef="Sequence_4">
          <Delay Duration="00:00:02" sap2010:WorkflowViewState.IdRef="Delay_2" />
          <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_4">
            <InArgument x:TypeArguments="x:String">
              <mca:CSharpValue x:TypeArguments="x:String">"Middle"+variable1</mca:CSharpValue>
            </InArgument>
          </WriteLine>
          <Assign sap2010:WorkflowViewState.IdRef="Assign_2">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Int32">
                <mca:CSharpReference x:TypeArguments="x:Int32">variable1</mca:CSharpReference>
              </OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Int32">
                <mca:CSharpValue x:TypeArguments="x:Int32">variable1+1</mca:CSharpValue>
              </InArgument>
            </Assign.Value>
          </Assign>
        </Sequence>
      </While>
      <While sap2010:WorkflowViewState.IdRef="While_3">
        <While.Variables>
          <Variable x:TypeArguments="x:Int32" Name="variable1" />
        </While.Variables>
        <While.Condition>
          <mca:CSharpValue x:TypeArguments="x:Boolean">variable1&lt;4</mca:CSharpValue>
        </While.Condition>
        <Sequence sap2010:WorkflowViewState.IdRef="Sequence_5">
          <Delay Duration="00:00:03" sap2010:WorkflowViewState.IdRef="Delay_3" />
          <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_5">
            <InArgument x:TypeArguments="x:String">
              <mca:CSharpValue x:TypeArguments="x:String">"right"+variable1</mca:CSharpValue>
            </InArgument>
          </WriteLine>
          <Assign sap2010:WorkflowViewState.IdRef="Assign_3">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Int32">
                <mca:CSharpReference x:TypeArguments="x:Int32">variable1</mca:CSharpReference>
              </OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Int32">
                <mca:CSharpValue x:TypeArguments="x:Int32">variable1+1</mca:CSharpValue>
              </InArgument>
            </Assign.Value>
          </Assign>
        </Sequence>
      </While>
    </Parallel>
    <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_6" Text="over" />
    <sads:DebugSymbol.Symbol>dzlEOlxUZXN0XFdGVGVzdFxXRlRlc3QuV0ZDb25zb2xlQXBwbGljYXRpb25cV29ya2Zsb3cxLnhhbWwlLAOIAQ4CAQEtBS1NAgFULgWFARACAQSGAQWGAUwCAQItQy1KAgFVLwdMEgIBOU0HaA8CAR9pB4QBDwIBBYYBQ4YBSQIBAzMJSxECATpUCWcUAgElUgtSWAIBIHAJgwEUAgELbgtuWAIBBjcLShYCAUA1DTVbAgE7VQtVUgIBN1YLWhcCATFbC2YUAgEmcQtxUgIBHXILdhcCARd3C4IBFAIBDDgNOFQCAVI5DT0ZAgFMPg1JFgIBQVUbVSUCAThYD1hfAgEyYxFjWQIBLF4RXl8CASdxG3ElAgEedA90XgIBGH8Rf1kCARJ6EXpfAgENOB04JwIBUzsRO18CAU1GE0ZbAgFHQRNBYQIBQg==</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="WriteLine_2" sap:VirtualizedContainerService.HintSize="1608,62" />
      <sap2010:ViewStateData Id="Delay_1" sap:VirtualizedContainerService.HintSize="242,22" />
      <sap2010:ViewStateData Id="WriteLine_3" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_1" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_2" sap:VirtualizedContainerService.HintSize="264,350">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="While_1" sap:VirtualizedContainerService.HintSize="464,510" />
      <sap2010:ViewStateData Id="Sequence_3" sap:VirtualizedContainerService.HintSize="486,634">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Delay_2" sap:VirtualizedContainerService.HintSize="242,22" />
      <sap2010:ViewStateData Id="WriteLine_4" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_2" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_4" sap:VirtualizedContainerService.HintSize="264,350">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="While_2" sap:VirtualizedContainerService.HintSize="464,634" />
      <sap2010:ViewStateData Id="Delay_3" sap:VirtualizedContainerService.HintSize="242,22" />
      <sap2010:ViewStateData Id="WriteLine_5" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_3" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_5" sap:VirtualizedContainerService.HintSize="264,350">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="While_3" sap:VirtualizedContainerService.HintSize="464,634" />
      <sap2010:ViewStateData Id="Parallel_1" sap:VirtualizedContainerService.HintSize="1608,680" />
      <sap2010:ViewStateData Id="WriteLine_6" sap:VirtualizedContainerService.HintSize="1608,62" />
      <sap2010:ViewStateData Id="Sequence_6" sap:VirtualizedContainerService.HintSize="1630,1008">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="WFTest.WFConsoleApplication.Workflow1_1" sap:VirtualizedContainerService.HintSize="1670,1088" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>

Pick

分支触发完成,任何一个分支完成,则整个通过,用我还没实际做过WF的脑袋想也能想到这个容器非常重要

<Activity mc:Ignorable="sap sap2010 sads" x:Class="WFTest.WFConsoleApplication.Workflow1"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="argName" Type="InArgument(x:String)" />
    <x:Property Name="argAge" Type="InArgument(x:Int32)" />
    <x:Property Name="argMessage" Type="InArgument(x:String)" />
  </x:Members>
  <sap2010:ExpressionActivityEditor.ExpressionActivityEditor>C#</sap2010:ExpressionActivityEditor.ExpressionActivityEditor>
  <sap2010:WorkflowViewState.IdRef>WFTest.WFConsoleApplication.Workflow1_1</sap2010:WorkflowViewState.IdRef>
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Text</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Microsoft.CSharp</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>WFTest.WFConsoleApplication</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_6">
    <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_2" Text="Start" />
    <Pick sap2010:WorkflowViewState.IdRef="Pick_1">
      <PickBranch DisplayName="Branch1" sap2010:WorkflowViewState.IdRef="PickBranch_1">
        <PickBranch.Variables>
          <Variable x:TypeArguments="x:Int32" Name="variable1" />
        </PickBranch.Variables>
        <PickBranch.Trigger>
          <While sap2010:WorkflowViewState.IdRef="While_1">
            <While.Condition>
              <mca:CSharpValue x:TypeArguments="x:Boolean">variable1&lt;18</mca:CSharpValue>
            </While.Condition>
            <Sequence sap2010:WorkflowViewState.IdRef="Sequence_2">
              <Delay Duration="00:00:01" sap2010:WorkflowViewState.IdRef="Delay_1" />
              <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_3">
                <InArgument x:TypeArguments="x:String">
                  <mca:CSharpValue x:TypeArguments="x:String">"Left"+variable1</mca:CSharpValue>
                </InArgument>
              </WriteLine>
              <Assign sap2010:WorkflowViewState.IdRef="Assign_1">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:Int32">
                    <mca:CSharpReference x:TypeArguments="x:Int32">variable1</mca:CSharpReference>
                  </OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:Int32">
                    <mca:CSharpValue x:TypeArguments="x:Int32">variable1+1</mca:CSharpValue>
                  </InArgument>
                </Assign.Value>
              </Assign>
            </Sequence>
          </While>
        </PickBranch.Trigger>
        <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_7" Text="Left Finish" />
      </PickBranch>
      <PickBranch DisplayName="Branch2" sap2010:WorkflowViewState.IdRef="PickBranch_2">
        <PickBranch.Variables>
          <Variable x:TypeArguments="x:Int32" Name="variable1" />
        </PickBranch.Variables>
        <PickBranch.Trigger>
          <While sap2010:WorkflowViewState.IdRef="While_3">
            <While.Condition>
              <mca:CSharpValue x:TypeArguments="x:Boolean">variable1&lt;4</mca:CSharpValue>
            </While.Condition>
            <Sequence sap2010:WorkflowViewState.IdRef="Sequence_5">
              <Delay Duration="00:00:03" sap2010:WorkflowViewState.IdRef="Delay_3" />
              <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_5">
                <InArgument x:TypeArguments="x:String">
                  <mca:CSharpValue x:TypeArguments="x:String">"right"+variable1</mca:CSharpValue>
                </InArgument>
              </WriteLine>
              <Assign sap2010:WorkflowViewState.IdRef="Assign_3">
                <Assign.To>
                  <OutArgument x:TypeArguments="x:Int32">
                    <mca:CSharpReference x:TypeArguments="x:Int32">variable1</mca:CSharpReference>
                  </OutArgument>
                </Assign.To>
                <Assign.Value>
                  <InArgument x:TypeArguments="x:Int32">
                    <mca:CSharpValue x:TypeArguments="x:Int32">variable1+1</mca:CSharpValue>
                  </InArgument>
                </Assign.Value>
              </Assign>
            </Sequence>
          </While>
        </PickBranch.Trigger>
        <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_8" Text="Right Finish" />
      </PickBranch>
    </Pick>
    <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_6" Text="over" />
    <sads:DebugSymbol.Symbol>dzlEOlxUZXN0XFdGVGVzdFxXRlRlc3QuV0ZDb25zb2xlQXBwbGljYXRpb25cV29ya2Zsb3cxLnhhbWwgLAN0DgIBAS0FLU0CAT8uBXEMAgEEcgVyTAIBAi1DLUoCAUAvB08UAgEiUAdwFAIBBXJDckkCAQM0C0wTAgElTglOVwIBI1ULbRMCAQhvCW9YAgEGOA1LGAIBKzYPNl0CASZOR05UAgEkWQ1sGAIBDlcPV1wCAQlvR29VAgEHOQ85VgIBPToPPhsCATc/D0oYAgEsWg9aVgIBIFsPXxsCARpgD2sYAgEPOR85KQIBPjwTPGECAThHFUddAgEyQhVCYwIBLVofWikCASFdE11iAgEbaBVoXQIBFWMVY2MCARA=</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="WriteLine_2" sap:VirtualizedContainerService.HintSize="1142,62" />
      <sap2010:ViewStateData Id="Delay_1" sap:VirtualizedContainerService.HintSize="242,22" />
      <sap2010:ViewStateData Id="WriteLine_3" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_1" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_2" sap:VirtualizedContainerService.HintSize="264,350">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="While_1" sap:VirtualizedContainerService.HintSize="464,510" />
      <sap2010:ViewStateData Id="WriteLine_7" sap:VirtualizedContainerService.HintSize="211,62" />
      <sap2010:ViewStateData Id="PickBranch_1" sap:VirtualizedContainerService.HintSize="494,770" />
      <sap2010:ViewStateData Id="Delay_3" sap:VirtualizedContainerService.HintSize="242,22" />
      <sap2010:ViewStateData Id="WriteLine_5" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_3" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_5" sap:VirtualizedContainerService.HintSize="264,350">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="While_3" sap:VirtualizedContainerService.HintSize="464,510" />
      <sap2010:ViewStateData Id="WriteLine_8" sap:VirtualizedContainerService.HintSize="211,62" />
      <sap2010:ViewStateData Id="PickBranch_2" sap:VirtualizedContainerService.HintSize="494,770" />
      <sap2010:ViewStateData Id="Pick_1" sap:VirtualizedContainerService.HintSize="1142,816" />
      <sap2010:ViewStateData Id="WriteLine_6" sap:VirtualizedContainerService.HintSize="1142,62" />
      <sap2010:ViewStateData Id="Sequence_6" sap:VirtualizedContainerService.HintSize="1164,1144">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="WFTest.WFConsoleApplication.Workflow1_1" sap:VirtualizedContainerService.HintSize="1204,1224" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>

ParallelForEach

同paralle,只不过都是相同任务的List作为参数

集合操作

AddToCollection

ClearCollection

ExistInCollection

RemoveFromCollection

这几个都比较简单,顾名思义,看名字就知道是干什么的

代码就简单写一下啦

<Activity mc:Ignorable="sap sap2010 sads" x:Class="WFTest.WFConsoleApplication.Workflow1"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="argName" Type="InArgument(x:String)" />
    <x:Property Name="argAge" Type="InArgument(x:Int32)" />
    <x:Property Name="argMessage" Type="InArgument(x:String)" />
  </x:Members>
  <sap2010:ExpressionActivityEditor.ExpressionActivityEditor>C#</sap2010:ExpressionActivityEditor.ExpressionActivityEditor>
  <sap2010:WorkflowViewState.IdRef>WFTest.WFConsoleApplication.Workflow1_1</sap2010:WorkflowViewState.IdRef>
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Text</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Microsoft.CSharp</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>WFTest.WFConsoleApplication</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_7">
    <Sequence.Variables>
      <Variable x:TypeArguments="scg:List(x:Int32)" Name="variable1">
        <Variable.Default>
          <mca:CSharpValue x:TypeArguments="scg:List(x:Int32)">new List&lt;int&gt;()</mca:CSharpValue>
        </Variable.Default>
      </Variable>
    </Sequence.Variables>
    <AddToCollection x:TypeArguments="x:Int32" sap2010:WorkflowViewState.IdRef="AddToCollection`1_1" Item="1">
      <InArgument x:TypeArguments="scg:ICollection(x:Int32)">
        <mca:CSharpValue x:TypeArguments="scg:ICollection(x:Int32)">variable1</mca:CSharpValue>
      </InArgument>
    </AddToCollection>
    <AddToCollection x:TypeArguments="x:Int32" sap2010:WorkflowViewState.IdRef="AddToCollection`1_2" Item="2">
      <InArgument x:TypeArguments="scg:ICollection(x:Int32)">
        <mca:CSharpValue x:TypeArguments="scg:ICollection(x:Int32)">variable1</mca:CSharpValue>
      </InArgument>
    </AddToCollection>
    <RemoveFromCollection x:TypeArguments="x:Int32" sap2010:WorkflowViewState.IdRef="RemoveFromCollection`1_1" Item="2">
      <InArgument x:TypeArguments="scg:ICollection(x:Int32)">
        <mca:CSharpValue x:TypeArguments="scg:ICollection(x:Int32)">variable1</mca:CSharpValue>
      </InArgument>
    </RemoveFromCollection>
    <AddToCollection x:TypeArguments="x:Int32" sap2010:WorkflowViewState.IdRef="AddToCollection`1_3" Item="3">
      <InArgument x:TypeArguments="scg:ICollection(x:Int32)">
        <mca:CSharpValue x:TypeArguments="scg:ICollection(x:Int32)">variable1</mca:CSharpValue>
      </InArgument>
    </AddToCollection>
    <ForEach x:TypeArguments="x:Int32" sap2010:WorkflowViewState.IdRef="ForEach`1_1">
      <ForEach.Values>
        <InArgument x:TypeArguments="scg:IEnumerable(x:Int32)">
          <mca:CSharpValue x:TypeArguments="scg:IEnumerable(x:Int32)">variable1</mca:CSharpValue>
        </InArgument>
      </ForEach.Values>
      <ActivityAction x:TypeArguments="x:Int32">
        <ActivityAction.Argument>
          <DelegateInArgument x:TypeArguments="x:Int32" Name="item" />
        </ActivityAction.Argument>
        <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_1">
          <InArgument x:TypeArguments="x:String">
            <mca:CSharpValue x:TypeArguments="x:String">item.ToString()</mca:CSharpValue>
          </InArgument>
        </WriteLine>
      </ActivityAction>
    </ForEach>
    <sads:DebugSymbol.Symbol>dzlEOlxUZXN0XFdGVGVzdFxXRlRlc3QuV0ZDb25zb2xlQXBwbGljYXRpb25cV29ya2Zsb3cxLnhhbWwSLANaDgIBATALMGcCAQI0BTgXAgEpOQU9FwIBIj4FQhwCARtDBUcXAgEUSAVYDwIBBzYJNmACASs0azRuAgEqOwk7YAIBJDlrOW4CASNACUBgAgEdPnU+eAIBHEUJRWACARZDa0NuAgEVSwtLYgIBD1IJVhUCAQhUDVRaAgEJ</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="AddToCollection`1_1" sap:VirtualizedContainerService.HintSize="287,22" />
      <sap2010:ViewStateData Id="AddToCollection`1_2" sap:VirtualizedContainerService.HintSize="287,22" />
      <sap2010:ViewStateData Id="RemoveFromCollection`1_1" sap:VirtualizedContainerService.HintSize="287,22" />
      <sap2010:ViewStateData Id="AddToCollection`1_3" sap:VirtualizedContainerService.HintSize="287,22" />
      <sap2010:ViewStateData Id="WriteLine_1" sap:VirtualizedContainerService.HintSize="211,62" />
      <sap2010:ViewStateData Id="ForEach`1_1" sap:VirtualizedContainerService.HintSize="287,212" />
      <sap2010:ViewStateData Id="Sequence_7" sap:VirtualizedContainerService.HintSize="309,584">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="WFTest.WFConsoleApplication.Workflow1_1" sap:VirtualizedContainerService.HintSize="349,664" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>

Parallel中使用 CancellationScope

在WF4中,可以使用[Parallel] 并行执行多条分支,当[Parallel]中的所有分支都执行完成后,[Parallel]结束.

可以使用[Pick]实现多条等待分支的单线执行,当一条分支被触发后,其它分支就不会被触发了,当触发的分支完成后,[Pick]结束

但有时我们会的这样一种需求,我们需要并行执行多条分支,当并行分支中的一条或几条分支满足指定条件时,其它正在执行的分支就不执了.同时,为了保证数据的完整性,我们需要在那些可能要取消的分支中余留一组代码.这组代码用于在该分支被取消后做一些收尾工做

可以在[Parallel]容器中使用[CancellationScope],当[Parallel]的[CompletionCondition]属性为[True]时,[Parallel]容器会在其内部[CancellationScope]容器执行完成后,结束其它正在执行的并行分支.如果其它正在执行的并行分支是[CancellationScope],则会调用该[CancellationScope]的[CancelHandler]

<Activity mc:Ignorable="sap sap2010 sads" x:Class="WFTest.WFConsoleApplication.Workflow1"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="argName" Type="InArgument(x:String)" />
    <x:Property Name="argAge" Type="InArgument(x:Int32)" />
    <x:Property Name="argMessage" Type="InArgument(x:String)" />
  </x:Members>
  <sap2010:ExpressionActivityEditor.ExpressionActivityEditor>C#</sap2010:ExpressionActivityEditor.ExpressionActivityEditor>
  <sap2010:WorkflowViewState.IdRef>WFTest.WFConsoleApplication.Workflow1_1</sap2010:WorkflowViewState.IdRef>
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Text</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Microsoft.CSharp</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>WFTest.WFConsoleApplication</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_10">
    <Sequence.Variables>
      <Variable x:TypeArguments="x:Boolean" Default="False" Name="variable1" />
    </Sequence.Variables>
    <Parallel sap2010:WorkflowViewState.IdRef="Parallel_1">
      <Parallel.CompletionCondition>
        <mca:CSharpValue x:TypeArguments="x:Boolean">variable1</mca:CSharpValue>
      </Parallel.CompletionCondition>
      <CancellationScope sap2010:WorkflowViewState.IdRef="CancellationScope_1">
        <Sequence sap2010:WorkflowViewState.IdRef="Sequence_8">
          <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_2" Text="执行A第一步" />
          <Delay Duration="00:00:03" sap2010:WorkflowViewState.IdRef="Delay_1" />
          <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_3" Text="执行A第二步" />
          <Assign sap2010:WorkflowViewState.IdRef="Assign_1">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Boolean">
                <mca:CSharpReference x:TypeArguments="x:Boolean">variable1</mca:CSharpReference>
              </OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Boolean">True</InArgument>
            </Assign.Value>
          </Assign>
        </Sequence>
        <CancellationScope.CancellationHandler>
          <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_4" Text="A执行完了,B不需要执行,So清除B已执行的步骤" />
        </CancellationScope.CancellationHandler>
      </CancellationScope>
      <CancellationScope sap2010:WorkflowViewState.IdRef="CancellationScope_2">
        <Sequence sap2010:WorkflowViewState.IdRef="Sequence_9">
          <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_5" Text="执行B第一步" />
          <Delay Duration="00:00:05" sap2010:WorkflowViewState.IdRef="Delay_2" />
          <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_6" Text="执行B第二步" />
          <Assign sap2010:WorkflowViewState.IdRef="Assign_2">
            <Assign.To>
              <OutArgument x:TypeArguments="x:Boolean">
                <mca:CSharpReference x:TypeArguments="x:Boolean">variable1</mca:CSharpReference>
              </OutArgument>
            </Assign.To>
            <Assign.Value>
              <InArgument x:TypeArguments="x:Boolean">True</InArgument>
            </Assign.Value>
          </Assign>
        </Sequence>
        <CancellationScope.CancellationHandler>
          <WriteLine sap2010:WorkflowViewState.IdRef="WriteLine_7" Text="B执行完了,A不需要执行,So清除B已执行的步骤" />
        </CancellationScope.CancellationHandler>
      </CancellationScope>
    </Parallel>
    <sads:DebugSymbol.Symbol>dzlEOlxUZXN0XFdGVGVzdFxXRlRlc3QuV0ZDb25zb2xlQXBwbGljYXRpb25cV29ya2Zsb3cxLnhhbWweLANeDgIBAS41LjwCAQIwBVwQAgEDNAdHGwIBGkgHWxsCAQkyCTJRAgEENQlDFAIBHUULRWYCARtJCVcUAgEMWQtZZgIBCjYLNlQCASk3CzdSAgEnOAs4VAIBJTkLQhQCAR5FSUVjAgEcSgtKVAIBGEsLS1ICARZMC0xUAgEUTQtWFAIBDVlJWWMCAQs2STZRAgEqNxs3JQIBKDhJOFECASZAN0A7AgEkPBE8YQIBH0pJSlECARlLG0slAgEXTElMUQIBFVQ3VDsCARNQEVBhAgEO</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="WriteLine_2" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Delay_1" sap:VirtualizedContainerService.HintSize="242,22" />
      <sap2010:ViewStateData Id="WriteLine_3" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_1" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_8" sap:VirtualizedContainerService.HintSize="264,452">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="WriteLine_4" sap:VirtualizedContainerService.HintSize="211,62" />
      <sap2010:ViewStateData Id="CancellationScope_1" sap:VirtualizedContainerService.HintSize="300,721" />
      <sap2010:ViewStateData Id="WriteLine_5" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Delay_2" sap:VirtualizedContainerService.HintSize="242,22" />
      <sap2010:ViewStateData Id="WriteLine_6" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Assign_2" sap:VirtualizedContainerService.HintSize="242,62" />
      <sap2010:ViewStateData Id="Sequence_9" sap:VirtualizedContainerService.HintSize="264,452">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="WriteLine_7" sap:VirtualizedContainerService.HintSize="211,62" />
      <sap2010:ViewStateData Id="CancellationScope_2" sap:VirtualizedContainerService.HintSize="300,721" />
      <sap2010:ViewStateData Id="Parallel_1" sap:VirtualizedContainerService.HintSize="754,767" />
      <sap2010:ViewStateData Id="Sequence_10" sap:VirtualizedContainerService.HintSize="776,891">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="WFTest.WFConsoleApplication.Workflow1_1" sap:VirtualizedContainerService.HintSize="816,971" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>

执行结果

ac056131-fa2c-4bb1-98f7-e59dd55075dc
执行A第一步
执行B第一步
执行A第二步
B执行完了,A不需要执行,So清除B已执行的步骤
状态:Closed
实例编号:ac056131-fa2c-4bb1-98f7-e59dd55075dc

InvokeMethod 调用方法

直接调用C#的方法,分为调用静态方法和调用示例方法两种

<Activity mc:Ignorable="sap sap2010 sads" x:Class="WFTest.WFConsoleApplication.Workflow1"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:local="clr-namespace:WFTest.WFConsoleApplication"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="argName" Type="InArgument(x:String)" />
    <x:Property Name="argAge" Type="InArgument(x:Int32)" />
    <x:Property Name="argMessage" Type="InArgument(x:String)" />
  </x:Members>
  <sap2010:ExpressionActivityEditor.ExpressionActivityEditor>C#</sap2010:ExpressionActivityEditor.ExpressionActivityEditor>
  <sap2010:WorkflowViewState.IdRef>WFTest.WFConsoleApplication.Workflow1_1</sap2010:WorkflowViewState.IdRef>
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Text</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Microsoft.CSharp</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>WFTest.WFConsoleApplication</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_11">
    <InvokeMethod sap2010:WorkflowViewState.IdRef="InvokeMethod_1" MethodName="SayHelloStatic" TargetType="local:OceanTest">
      <InArgument x:TypeArguments="x:String">ocean</InArgument>
    </InvokeMethod>
    <InvokeMethod sap2010:WorkflowViewState.IdRef="InvokeMethod_2" MethodName="SayHelloInstance">
      <InvokeMethod.TargetObject>
        <InArgument x:TypeArguments="local:OceanTest">
          <mca:CSharpValue x:TypeArguments="local:OceanTest">new OceanTest()</mca:CSharpValue>
        </InArgument>
      </InvokeMethod.TargetObject>
      <InArgument x:TypeArguments="x:String">Ocean</InArgument>
    </InvokeMethod>
    <sads:DebugSymbol.Symbol>dzlEOlxUZXN0XFdGVGVzdFxXRlRlc3QuV0ZDb25zb2xlQXBwbGljYXRpb25cV29ya2Zsb3cxLnhhbWwGLQM6DgIBAS4FMBQCAQgxBTgUAgECLy4vMwIBCTQLNF8CAQQ3LjczAgED</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="InvokeMethod_1" sap:VirtualizedContainerService.HintSize="218,130" />
      <sap2010:ViewStateData Id="InvokeMethod_2" sap:VirtualizedContainerService.HintSize="218,130" />
      <sap2010:ViewStateData Id="Sequence_11" sap:VirtualizedContainerService.HintSize="240,424">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="WFTest.WFConsoleApplication.Workflow1_1" sap:VirtualizedContainerService.HintSize="280,504" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>
    public class OceanTest
    { 
        public static void SayHelloStatic(string name)
        {
            string msg= "Hello " + name + ". I am from blog.wx6.org Static";
            Console.WriteLine(msg);
        } 
        public   void SayHelloInstance(string name)
        {
            string msg = "Hello " + name + ". I am from blog.wx6.org Instance";
            Console.WriteLine(msg);
        }
    }

written by ocean