I have a class A with a public method in C#. I want to allow access to this method to only class B. Is this possible?
UPDATE:
This is what i
You can restrict method/class access in this way:
[StrongNameIdentityPermissionAttribute(SecurityAction.Demand, PublicKey="…hex…", Name="App1", Version="0.0.0.0")]
public class Class1 { }
Take a look here http://msdn.microsoft.com/en-us/library/c09d4x9t.aspx for more info.
Managed code offers several ways to restrict method access:
...
- Limit the method access to callers of a specified identity--essentially, any particular evidence (strong name, publisher, zone, and so on) you choose.