Prev: Find Sub Folder Name within a Folder
Next: The Activities property is 'ReadOnly' in VB, not in C# ?
From: Gilbert Tordeur on 12 Jul 2010 09:54 Hello. In order to learn WF4 I have read "A Developer's Introduction to Windows Workflow Foundation (WF) in .NET 4" (http://msdn.microsoft.com/en-us/library/ee342461.aspx). Unfortunately it is in C# while my preferred language is VB. So I try to translate. The first example is the following: [TestMethod] public void TestHelloWorldStatic() { StringWriter Sw = new StringWriter(); Console.SetOut(Sw); Sequence Wf = new Sequence { Variables = { new Variable<string>{Default = "Hello", Name = "greeting"}, new Variable<string>{Default = "Bill", Name = "name"} }, Activities = { new WriteLine {Text = new VisualBasicValue<string>("greeting")}, new WriteLine {Text = new VisualBasicValue<string>("name & \"Gates\"")} } }; WorkflowInvoker.Invoke(Wf); Assert.IsTrue(String.Compare("Hello\r\nWorld\r\n", Sw.GetStringBuilder().ToString()) == 0, "Incorrect string written"); } which compiles without any flag. I translate it into VB: <TestMethod()> Public Sub TestMethod1() Dim Sw = New StringWriter Console.SetOut(Sw) Dim Wf As Sequence = New Sequence With { _ .Activities = { _ New WriteLine With { _ .Text = "Hello" _ } _ , New WriteLine With { _ .Text = "World" _ } _ } _ } WorkflowInvoker.Invoke(Wf) Assert.IsTrue(String.Compare("Hello\r\nWorld\r\n", Sw.GetStringBuilder.ToString) = 0, "Incorrect string written") End Sub which compiles with a flag telling that the Activities property is 'ReadOnly' ! Did I make a translation error ? Thanks for your help, Gilbert P.S. and if you know a good introduction to WF4 in VB I will be much interested.
From: Cor Ligthert[MVP] on 12 Jul 2010 13:28 Tried to answer in the forum, although I could not do much. "Gilbert Tordeur" <gilbert.tordeur(a)orange.fr> wrote in message news:eozVOncILHA.4120(a)TK2MSFTNGP02.phx.gbl... > Hello. > > In order to learn WF4 I have read "A Developer's Introduction to Windows > Workflow Foundation (WF) in .NET 4" > (http://msdn.microsoft.com/en-us/library/ee342461.aspx). Unfortunately it > is in C# while my preferred language is VB. So I try to translate. > > The first example is the following: > > [TestMethod] > public void TestHelloWorldStatic() > { > StringWriter Sw = new StringWriter(); > Console.SetOut(Sw); > Sequence Wf = new Sequence > { > Variables = > { > new Variable<string>{Default = "Hello", Name = > "greeting"}, > new Variable<string>{Default = "Bill", Name = "name"} > }, > Activities = > { > new WriteLine {Text = new > VisualBasicValue<string>("greeting")}, > new WriteLine {Text = new > VisualBasicValue<string>("name & \"Gates\"")} > } > }; > WorkflowInvoker.Invoke(Wf); > Assert.IsTrue(String.Compare("Hello\r\nWorld\r\n", > Sw.GetStringBuilder().ToString()) == 0, "Incorrect string written"); > } > which compiles without any flag. > > I translate it into VB: > > <TestMethod()> > Public Sub TestMethod1() > Dim Sw = New StringWriter > Console.SetOut(Sw) > Dim Wf As Sequence = New Sequence With { _ > .Activities = { _ > New WriteLine With { _ > .Text = "Hello" _ > } _ > , New WriteLine With { _ > .Text = "World" _ > } _ > } _ > } > > WorkflowInvoker.Invoke(Wf) > Assert.IsTrue(String.Compare("Hello\r\nWorld\r\n", > Sw.GetStringBuilder.ToString) = 0, "Incorrect string written") > > End Sub > which compiles with a flag telling that the Activities property is > 'ReadOnly' ! > > Did I make a translation error ? > > Thanks for your help, > Gilbert > > P.S. and if you know a good introduction to WF4 in VB I will be much > interested. > > >
|
Pages: 1 Prev: Find Sub Folder Name within a Folder Next: The Activities property is 'ReadOnly' in VB, not in C# ? |