Kjetil said:
Again it comes down to context. If your context is I have an object and I
need to marshall it across an appdomain, then you will think that is the
primary purpose of the type. If your context is how that architecture works
then you will think in terms of why that class is there in that context.
I don't think that really makes sense as a way of thinking about the
primary purpose of a type. "How it works" (i.e. the implementation)
isn't the *reason* for a type existing.
Surely a good test for the primary purpose of a type is to see whether
or not it would still be worth having if that purpose weren't required.
Let's test that theory:
Suppose marshalling by reference didn't require inlining to be avoided
- for example if the CLR didn't do any inlining anyway. Would
MarshalByRefObject still be worth having? Absolutely. Admittedly in
this case it could be replaced by an attribute, potentially, as
described in
http://blogs.thinktecture.com/ingo/archive/2003/01/24/413866.aspx
You'd still need something to indicate that you wanted marshalling by
reference though, and deriving from MarshalByRefObject is currently
*the* way of doing that.
Now suppose instead that no-one ever needed to marshal by reference,
but occasionally did want to prevent inlining. Would MarshalByRefObject
still be worth having? Nope - MethodImplOptions already has that
functionality.
For these reasons, I still think it makes little sense to claim that
the primary purpose of the MarshalByRefObject type is to prevent
inlining. That may well be a very important part of its implementation,
but that's not the same thing at all.