Making sure I understand what you mean here: For example a "Bindable"
attrbute on a SMTP communication utility class would not make sense? Is
that what you mean?
I don't understand the question. I don't know enough about binding to
know what it would mean to bind a whole class, but assuming you had
something about your utility class that was in fact bindable, why not have
the property on the class?
The point would be that the class author should not apply the
BindableAttribute attribute to the class if the class shouldn't be used in
binding. If you're asking about someone _using_ the class applying that
attribute to a property or variable referencing an instance of the class,
then whether the BindableAttribute attribute makes sense would, I think,
depend on whether you had a reliable way to connect the property or
variable to something that gets or sets an instance of the class.
What about the BindableAttribute attribute is it that you're saying is
inherently incompatible with this "SMTP communication utility class"? And
more important, why is that relevant to what I wrote?
Again I'm not sure I'm following, it could be that it's over my head. ;0)
Isn't the fact that I've included the attribute on the interface enough
to
tell it that it applies? I thought that was the purpose of an interface:
"You must do this and it must support that"
I think you're looking at it from the wrong end. The attribute applies to
the member of the _interface_, as Jesse wrote. You're expecting it to
somehow propagate from the interface to something that implements the
interface, but they don't. The attribute you write in the interface
applies _to the member of the interface_ itself.
Interfaces are themselves legitimate language objects. They aren't just
syntax. They are a "thing" just like a class, struct, enum, etc. is a
thing. And when you apply an attribute, it applies to the thing, not the
thing that uses the thing.
Now, for some members it may be that in an interface the attribute doesn't
make any sense or isn't useful. But there's no way to represent that as
far as I know.
In any case, you asked a specific question, which essentially was "should
I be surprised at how this works?" I answered that with essentially a
"no". I understand why you were surprised, but I don't find the behavior
itself surprising, nor do I think it should be surprising once you think
about what the attribute is actually applied to. But keep in mind that
that's just my opinion. The behavior doesn't surprise me and so I don't
think it should surprise you. But that's just my opinion, which you asked
for. If you want to be surprised, I think that's your prerogative.
Pete