Using .NET 2.0 you could scope the setter to internal and the reader to
public .. you might also be able to use Friend assemblies
http://msdn2.microsoft.com/en-US/library/0tke9fxk.aspx if it is outside of
your assembly in a known assembly.
in 1.x you would create a readonly property and a method to set it that is
scoped internally ...
If the other object is not within the same assembly and is not known at time
of development you would have to use a reflections based methodology to call
a private method or to set the private field directly.
Cheers,
Greg Young
MVP - C#
"rob" <rm*******@yahoo.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Here is the scenario. I have a manager class that accepts objects of a
given base type. When I want the object to be processed by the manager
I pass it to the manager which then assigns an ID to the object passed
in. The user can then retrieve that ID.
The problem is that the manager must be able to assign an ID to the
object whereas the user should not be allowed to set the ID. What is
the best approach to solve this problem.
Thanks