-1
I have a DLL that has several internal methods, I want to protect these internal methods so that they are called only by the DLL itself.
Is there any way to define which methods may or may not be called externally to DLL?
-1
I have a DLL that has several internal methods, I want to protect these internal methods so that they are called only by the DLL itself.
Is there any way to define which methods may or may not be called externally to DLL?
2
Yes, you must use the internal
in each method that can only be called by the DLL.
The whole class can be internal
also. Actually this is the standard.
It can be used with protected
also, since this constraint has to do with heritage and not with simple visibility.
Something like that:
public class Tricycle {
//só pode ser acessado por tipos dentro da DLL
internal void Pedal() { }
//pode ser acessado por uma classe qualquer que derive desta, ou tipos desta DLL.
protected internal int Wheels => { get; } => 3
}
Browser other questions tagged c# oop .net-assembly visibility
You are not signed in. Login or sign up in order to post.
http://stackoverflow.com/questions/614818/what-is-the-difference-between-public-private-protected-and-nothing
– novic