GetCallingAssembly in BaseClasses

M

Michael Maes

Hello,

If you want to have the Assembly who is Calling a certain Method in another one, you use 'GetCallingAssembly'.
So far no problem.
However:

If you have the following Architecture:

Library-Assembly

myLibrary (Root NS)

Class BaseClass

Methods X, Y, Z

End Class

Class ChildOne
Inherits BaseClass

Methods A, B, C

End Class

Class ChildTwo
Inherits BaseClass

Methods D, E, F

End Class

........

Running Project

myProject

References myLibrary

Calls a method in myLibrary

If you Determine the 'GetCallingAssembly' in SubClass ChildOne or SubClass ChildTwo, then you get a refence to 'myProject' which is correct.
If you Determine the 'GetCallingAssembly' in the BaseClass, then you get a refence to 'myLibrary' (which, in a certain way, is also correct). But here I would also like to "have" 'myProject'.

So I thought: Let's be "smart" and have "Me.GetType.Assembly.GetCallingAssembly.GetCallingAssembly" (in the BaseClass), but helas, that still returns 'myLibrary'.

Is there a way to find out who called a method in a Derived Class by the BaseClass?

TIA,

Michael
 
P

Peter Huang

Hi Chris,

I reviewed the thread and find there is a similar issue in the group below.
Subject: Return-Type in Base & Inherited Class
Newsgroups: microsoft.public.dotnet.languages.vb

I have replied in that group and you may try to take a look.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top