Enabling Access to Private Fields
From: Jeff Benson (blaster151_at_hotmail.com)
Date: 10/26/03
- Next message: Russell B. Eggen: "Re: Enabling Access to Private Fields"
- Previous message: Nick Carter: "PrincipalPermissionAttribute Confusion"
- Next in thread: Russell B. Eggen: "Re: Enabling Access to Private Fields"
- Reply: Russell B. Eggen: "Re: Enabling Access to Private Fields"
- Reply: Jason: "Re: Enabling Access to Private Fields"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sun, 26 Oct 2003 09:48:38 -0600
Hello,
I am wondering if it is possible to use declarative security permissions (or
some other technique) to allow a dynamically synthesized assembly (one that
I'm compiling on-the-fly from C# code I've built myself at runtime) to
access private fields on classes in the assembly that's performing the
dynamic compilation.
In other words, code in Assembly A wants to dynamically compile a new
Assembly B (using the System.CodeDom.Compiler namespace) and allow Assembly
B to access private fields in Assembly A. (I could probably make them
"protected" or "internal" if I had to, but would prefer to let them remain
private.)
Since I know that Assembly B could access Assembly A's private fields
through reflection (just much more slowly), it seems to me that it must be
possible to enable it to access them directly. I've done some preliminary
reading about code-level permissions, but haven't found the solution. Any
advice or even pointers in the right direction would be tremendously
appreciated!
Thanks in advance,
Jeff Benson
blaster151@hotmail.com
- Next message: Russell B. Eggen: "Re: Enabling Access to Private Fields"
- Previous message: Nick Carter: "PrincipalPermissionAttribute Confusion"
- Next in thread: Russell B. Eggen: "Re: Enabling Access to Private Fields"
- Reply: Russell B. Eggen: "Re: Enabling Access to Private Fields"
- Reply: Jason: "Re: Enabling Access to Private Fields"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]