Dedicated Task Class

A task can be encapsulated in a class if the task logic is not very simple one or two lines of code. Therefore, if you want to encapsulate a task in a class, you can simply create a class inheriting a base class named CodedTaskBase. Then, override a method named "ExecuteAsync" that returns a Task<string> type. The string is just a message about the task which will be shown in the Log. Here is an example of an encapsulated task class.

dedicated task class

Once you encapsulate a task in a separate class, you can include an instance of that class in the TaskIndex class as shown here.

Task  List with  Encapsulated  Task

Last updated on 26 December 2014, Friday, 12:38:17 AM