I have a particular case in my current project.
I have:
public class A
{
// etc.
}
public class B
{
// etc.
private void HandleSomeEvent(object parameter)
{
// Etc.
}
protected void HandleSomeOtherEvent(object parameter)
{
// Etc.
}
}
I want:
A
to be able to call the private methodB.HandleSomeEvent
, but no other class (butB
) to be able to do thatA
to be able to call the protected methodB.HandleSomeOtherEvent
, but no other class (butB
andB
's derived classes) to be able to do that
Is that possible in C# ?
- If possible, how to do that?
- If not possible, what are the alternatives which can protect
B
as much as possible from tampering from, say, a classC
in the same assembly?