Re: constant references
On Feb 5, 7:36 am, "Zytan" <zytanlith...@y ahoo.comwrote:
Zytan,
ReadOnlyCollect ion is a proxy object because it can masquerade as an
IList like the original collection. The read-only check is performed
at runtime.
Brian
On Feb 5, 7:36 am, "Zytan" <zytanlith...@y ahoo.comwrote:
Terry,
>
>
Thanks for the reply. Branco mentioned this earlier, and he claimed
that it still would only be caught at run time. I am not sure, I'd
have to test and see. But, this is better than nothing. And it's
better than proxy objects because it is specifically designed for
this, needing much less code. I'll give it a shot.
>
Thanks,
>
Zytan
>
I know I am a little late in joining this discussion, but I was just reading
something in the documentation that may be of some help - not sure since I
have not tried it yet. New to the .Net Framework version 2 is the
"Array.AsReadOn ly" Generic Method that returns a read-only wrapper for the
specified array. So if you passed the original array (reference) byval, the
first line of code could be something like:
TheArray = Array.AsReadOnl y(TheArray) ' assuming the param was "TheArray"
Then it seems to me that the compiler should find and flag any attempts to
modify the array. And of course, the byval keeps the original reference from
being modified.
something in the documentation that may be of some help - not sure since I
have not tried it yet. New to the .Net Framework version 2 is the
"Array.AsReadOn ly" Generic Method that returns a read-only wrapper for the
specified array. So if you passed the original array (reference) byval, the
first line of code could be something like:
TheArray = Array.AsReadOnl y(TheArray) ' assuming the param was "TheArray"
Then it seems to me that the compiler should find and flag any attempts to
modify the array. And of course, the byval keeps the original reference from
being modified.
Thanks for the reply. Branco mentioned this earlier, and he claimed
that it still would only be caught at run time. I am not sure, I'd
have to test and see. But, this is better than nothing. And it's
better than proxy objects because it is specifically designed for
this, needing much less code. I'll give it a shot.
>
Thanks,
>
Zytan
ReadOnlyCollect ion is a proxy object because it can masquerade as an
IList like the original collection. The read-only check is performed
at runtime.
Brian
Comment