Marker Interfaces

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was wondering how the INamingContainer interface works when you are not
required to implement any methods to perform the work. My understanding of
interfaces is that they are a contract and you implement the logic yourself,
following the interface's contract. What confuses me is how does this
INamingContainer work when you don't implement any logic. In an example I am
looking at which prompted this Q, I see that this interface is being used to
give all child controls a uniqueID, but nowhere in the code do I see any
implementation that is actually performing this logic. What is happening
under the covers and how does this work???

Thanks in advance,
Chris
 
I was wondering how the INamingContainer interface works when you are not
required to implement any methods to perform the work. My understanding of
interfaces is that they are a contract and you implement the logic yourself,
following the interface's contract. What confuses me is how does this
INamingContainer work when you don't implement any logic. In an example I am
looking at which prompted this Q, I see that this interface is being used to
give all child controls a uniqueID, but nowhere in the code do I see any
implementation that is actually performing this logic. What is happening
under the covers and how does this work???

INamingContainer is a marker interface. You don't need to actually code
any functionality to use it. As ASP.NET page framework will create a new
naming scope for your control if you implement the INamingContiner
interface, ensuring that the child controls have unique names.
 
Back
Top