Tech Off Post

Single Post Permalink

View Thread: Internal Scope being accessed outside an assembly?
  • User profile image

    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?