Re: circular reference and events



On 1/17/11 1:48 PM, mp wrote:
[...]
looks like i have to change
void Subscribe(IPresenter presenter)
to
public void Subscribe(IPresenter presenter)

is that right?

Yes, just a minor typo. Implicit interface implementation members must be declared as public.

which got me to wondering
why doesn't
class Model : IModel
have to be
public class Model : IModel
presenter could still see Model even though it wasn't defined public
i thought default in c# was private for anything not defined public or
other?

Default for top-level types is "internal", not "private".

More generally, the default accessibility for declarations is going to be the _least_ accessible choice that can still allow the declared item to be used. For type members (including nested types), "private" is the default because the outer type can still use those items. But for top-level types, "private" doesn't make sense, so "internal" is the default.

Types only need to be "public" if you want them to be available when that assembly is referenced by another assembly.

Pete
.