Re: C# - Adding event delegate declarations to interfaces
- From: Barry Kelly <barry.j.kelly@xxxxxxxxx>
- Date: Mon, 03 Jul 2006 05:30:47 +0100
steve <steve@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I want to be able to hirearchally define event delegate (declarations)
WITHIN interfaces.
Unfortunatelly C# 1 doesn't appear to support it.
What exactly does this mean? What is hierarchical?
Do you mean that the declaration of the delegate type is lexically
nested inside the interface? You can't do that, but it wouldn't give you
anything anyway - it would just mean that every client of the delegate
type would have to fully qualify the delegate type, which would be a
pain for all the users.
How does the following look as a work-around? Are there better ways of
doing this?
I'm not sure why you seem to want to lexically enclose types inside your
interface type - if that's the functionality you're after. Nested types
aren't a common pattern in C#. They are common in C++ for enumeration
types, for example, but that's because C++ enumeration types don't need
to be qualified by the enumeration name.
C# doesn't have this feature/flaw, so nested types are generally only
required when the inner type needs access to private and protected
fields of the enclosing type. Since interfaces can only have public
members, there isn't a need for types nested inside interfaces.
-- Barry
--
http://barrkel.blogspot.com/
.
- References:
- Prev by Date: Re: mail failed
- Next by Date: Re: Passing delegates in structure to C dll
- Previous by thread: C# - Adding event delegate declarations to interfaces
- Next by thread: Re: C# - Adding event delegate declarations to interfaces
- Index(es):
Relevant Pages
|