I'm diving into WWF and noticed something that's at opposition to my original understanding of the scope modifier 'internal'.
To create a custom activity in WWF you inherit from System.Workflow.ComponentModel.Activity and override the Execute method which is defined as:
protected internal virtual
ActivityExecutionStatus Execute(ActivityExecutionContext
executionContext);
This all works as expected but I noticed that the Execute method is marked internal. My understanding of the internal keyword is that all classes or members marked internal are only available to the containing assembly.
How is it that Execute is available to my code?
[Took a quick check at my code and reflector to double check my post and found something new]
I don't actually have access to call the execute method in my derived class. This seems very interesting. So since the method is marked protected virtual, I'm allowed to override it ignoring the internal scope, but can't actually call it. Does this seem odd
to anyone else? So how would I create a method that is overridable only to classes in my assembly, drop the protected modifier?
-
-
'Internal protected' means can be accessed from current assembly or by any other class that extends this one.... think of the mnodiffiers like having and 'or' between them 'internal or protected' access
-
Beautiful! I was going to say, but I can't get to the Execute method in my assembly but then I realized it's not public, it's protected, and indeed I can access execute from within the derived class.
Thanks for the response.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.