You can probably determine the calling class by examining the stack,
although I wouldn't recommend it.
You can also follow the model commonly seen in handling events, in
which the sender is sent as a parameter. Your class' function would look
like myClass.DoWhatever(object sender, ...)
Then you could evaluate sender.GetType() and do whatever you need.
Your best bet, however, is to design your classes with member visibility
in mind (private, protected, public), and ask yourself why certain classes
should be allowed to call methods and not others, and design with
inheritance, with these ideas in mind.
Erik
"acg" <an*******@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
If you have a class with a public method, and another class which will
want to call this method, is there a way to determine the type of the
calling class within the method being called?
For I want to gaurantee only certain other classes/object types can call a
specific method in given class. Any advice would be appreciated and if
there is anything that can be done to use the frameworks inherent
permissioning.
Regards,
acg