Only when you use interface.
You'd have to edit type and you can't change type of existing object.

paszczi wrote:
> Hi!
>
> I'm trying to make a readonly version of several classes inside my
> projects that are meant to hold data. The flow is:
>
> (1)
> DataClass instance with filled properties -> MakeReadonly() ->
> DataClass instance cannot be changed.
>
> I wanted to do it using DynamicProxy - generating proxies and adding
> appropriate interceptors, but there's no way I can point
> ProxyGenerator to actually use already instantiated object - each call
> to property setter and getter should run through interceptor (this is
> easy) but finally target should be set to DataClass object created in
> (1) and not the newly created one. I was able to somehow workaround
> this by playing with IInvocation (invocation.Method.Invoke()) but this
> is so slow. Another way would be to force each developer to create a
> copying constructor in their objects but this requires too much
> effort :) Any suggestions, is it possible?
>
> >
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to