GetEmbedded Resource from Derived class

J

John

Hi,

I have a base class that's compiled in an assembly.
public class mybase
{
public void mymethod()
{
//can i get the embeded resources?
//Stream st =
assembly.GetCallingAssembly.GetManifestResourceStream("ResourceName");
}
}

I create another project, added a class derived from the mybase
public class myderived : mybase
{

}
and I have an embedded resource in this assembly.

My question is how (is it possible) to get the embedded resource in the
derived class assembly from the mymethod() in the base class?

Thanks very much!

John
 
G

Guest

Hi John,

Thank you for posting in the community!

Based on my understanding, you use
assembly.GetCallingAssembly.GetManifestResourceStream to get the resource
in a parent class in an assembly, then you derive from this class and
calling mymethod(Which is overrided from parent class) in the child class,
you want to know if this is possible.

===============================================
In your code, you invoke Assembly.GetCallingAssembly which will return the
Assembly of the method that invoked the currently executing method.
So althrough mymethod is overrided from parent class,
Assembly.GetCallingAssembly will return the child class's assembly.

Then, GetManifestResourceStream will retrieve the child assembly's
resource. So your code should work as you expected.

Addtionally, for more information about how to deal with Resource in
VS.net, please refer to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/htm
l/winforms02202003.asp

===============================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Hi John,

Is your problem resolved?

If you still have anything unclear, please feel free to tell me, I will
help you.

Best regards,
Jeffrey Tan
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