Search code examples
.networkflow-foundation-4

Parent activity type for NativeActivity activities


Is there any way in which it can be seen the type of the parent activity of a NativeActivity from the Execute method ?


Solution

  • Yes, you can execute the following code block and it will return you the value of the internal Parent property -- this will be the instance of your parent.

    this.GetType()
        .GetProperty(
            "Parent", 
            System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
        .GetValue(this, null)