Прочетете на английски Редактиране

Споделяне чрез


NativeActivity Constructor

Definition

When implemented in a derived class, creates a new instance of the derived class.

C#
protected NativeActivity();

Examples

The following code sample demonstrates creating a class that inherits from NativeActivity<TResult>. This example is from the Custom Composite using Native Activity sample.

C#
public sealed class MySequence : NativeActivity
{
    Collection<Activity> children;
    Collection<Variable> variables;
    Variable<int> currentIndex;
    CompletionCallback onChildComplete;

    public MySequence()
        : base()
    {
        this.children = new Collection<Activity>();
        this.variables = new Collection<Variable>();
        this.currentIndex = new Variable<int>();
    }

    public Collection<Activity> Activities
    {
        get
        {
            return this.children;
        }
    }

    public Collection<Variable> Variables
    {
        get
        {
            return this.variables;
        }
    }

Applies to

Продукт Версии
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1