September 2010
Intermediate to advanced
272 pages
5h 16m
English
CodeActivity
is an abstract class inherited from Activity. We can put our logic code in its Execute
method. In this task, we are going to create an activity that will write data to a text file.
Add a new code file to ActivityLibrary project named FileWriter.cs. Then replace all default code with the following code:
using System; using System.Activities; using System.Threading; public sealed class FileWriter : CodeActivity { [RequiredArgument] public InArgument<string> fileName { get; set; } [RequiredArgument] public InArgument<string> fileData { get; set; } protected override void Execute(CodeActivityContext context) { string lines = fileData.Get(context); // Write ...