Is there any way to either derive a sealed class, or access private
members of a sealed class? Either that, or is there a way to run
internal methods in a sealed class outside the current assembly? I
don't mind if the solution is hackish, the dll i'm writing is already
full of code hacks. =p 8 2624
shawnz <zi*******@gmail.com> wrote: Is there any way to either derive a sealed class, or access private members of a sealed class? Either that, or is there a way to run internal methods in a sealed class outside the current assembly? I don't mind if the solution is hackish, the dll i'm writing is already full of code hacks. =p
You can't derive from a sealed class, but you can access members you're
not supposed to using reflection *if* you've got sufficient
permissions.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Thanks for the advice! I didn't think to use reflection on them... This
will work on types outside the current assembly (in a reference) right?
Also, could you give me a function to point me in the right direction
doc-wise?
Probably the best thing to do instead is to take a hard look at your
design and refactor it until you get rid of the hacks. If your code is
already "full of hacks" you're just digging your grave deeper.
~justin
shawnz wrote: Thanks for the advice! I didn't think to use reflection on them... This will work on types outside the current assembly (in a reference) right? Also, could you give me a function to point me in the right direction doc-wise?
To be honest, the reason behind this is i'm trying to get around the
Internet wlm add-in sandbox without patching MessengerClient.dll. So,
using dodgy code hacks is almost my only line of defense before I
resort to doing something that can't be distributed. :p
justncase80 wrote: Probably the best thing to do instead is to take a hard look at your design and refactor it until you get rid of the hacks. If your code is already "full of hacks" you're just digging your grave deeper.
~justin
shawnz wrote: Thanks for the advice! I didn't think to use reflection on them... This will work on types outside the current assembly (in a reference) right? Also, could you give me a function to point me in the right direction doc-wise?
Maybe DotMsn can help you: http://www.xihsolutions.net/dotmsn/
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"shawnz" wrote: To be honest, the reason behind this is i'm trying to get around the Internet wlm add-in sandbox without patching MessengerClient.dll. So, using dodgy code hacks is almost my only line of defense before I resort to doing something that can't be distributed. :p
justncase80 wrote: Probably the best thing to do instead is to take a hard look at your design and refactor it until you get rid of the hacks. If your code is already "full of hacks" you're just digging your grave deeper.
~justin
shawnz wrote: Thanks for the advice! I didn't think to use reflection on them... This will work on types outside the current assembly (in a reference) right? Also, could you give me a function to point me in the right direction doc-wise?
You could put an instance of the class in your class and expose all the
properties and then either call the sealed class or do your own stuff.
shawnz wrote: Is there any way to either derive a sealed class, or access private members of a sealed class? Either that, or is there a way to run internal methods in a sealed class outside the current assembly? I don't mind if the solution is hackish, the dll i'm writing is already full of code hacks. =p
"shawnz" <zi*******@gmail.com> wrote in message
news:11**********************@m38g2000cwc.googlegr oups.com... Thanks for the advice! I didn't think to use reflection on them... This will work on types outside the current assembly (in a reference) right?
Yes.
Also, could you give me a function to point me in the right direction doc-wise?
Look at System.Reflection.FieldInfo and System.Reflection.MethodInfo.
shawnz wrote: Thanks for the advice! I didn't think to use reflection on them... This will work on types outside the current assembly (in a reference) right? Also, could you give me a function to point me in the right direction doc-wise?
Also, another quick question, I realized I can't set the variables
myself because their types depend on to many other internal things. Is
there a way to just call the internal "Startup()" function from my dll?
Could I possibly inject a function into my instance of the class and
run that to run "Startup()"? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steven T. Hatton |
last post by:
This may be another question having an obvious answer, but I'm not seeing
it. I'm trying to create a class that derives from
std::valarray<std::string>. I don't need a template, and I haven't come...
|
by: Zeng |
last post by:
Would somebody know when we should seal a class? Shouldn't all classes be
open up for inheritance?
Thanks!
|
by: Mahesh Devjibhai Dhola |
last post by:
Hi All,
I want to make a custom class in c#, which extends System.Xml.XmlNode class
of BCL.
Now in custom class, I have implement abstract methods of XmlNode class
also. Now when I am trying to...
|
by: Mark Rae |
last post by:
Hi,
Since sealed classes can't be instantiated with the new keyword e.g. CClass
objClass = new CClass(), does this mean that they don't have constructors /
deconstructors or, if they do, that...
|
by: Kylin |
last post by:
any better reason ?
--
FireCrow Studio
Kylin Garden
EMail:gaotianpu@gmail.com
ICQ:156134382
|
by: Vedo |
last post by:
ref struct XXX abstract sealed
{
literal int A = 5;
};
The definition above gives me the compiler warning "C4693: a sealed abstract
class cannot have any instance members 'A'". The equivalent...
|
by: Zytan |
last post by:
I know you cannot have a sealed static class, but why not? Why must
static classes be left open to inheritance?
This article: http://msdn.microsoft.com/msdnmag/issues/03/07/NET/
recommends to...
|
by: Shraddha |
last post by:
Can I stop people by deriving my class?
I mean I don't want my class to be as a base class...
Can I do that?
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |