Does anybody have a clue why a text in a book say this

T

Tony Johansson

Hello!

I read a book and there is a pice of text that say the follwing.
"In strictest definition of a component in the .NET Framework, a component
must implement the System.ComponentModel.IComponent interface, which include
methods that can be called by other components to release no-longer used
system resources and to support integration with design tools."

I know that it works perfectly well to create a component without
implementing System.ComponentModel.IComponent interface.
So is the best practice to implement System.ComponentModel.IComponent
interface when I create a component ?

//Tony
 
R

Registered User

Hello!

I read a book and there is a pice of text that say the follwing.
"In strictest definition of a component in the .NET Framework, a component
must implement the System.ComponentModel.IComponent interface, which include
methods that can be called by other components to release no-longer used
system resources and to support integration with design tools."

I know that it works perfectly well to create a component without
implementing System.ComponentModel.IComponent interface.
So is the best practice to implement System.ComponentModel.IComponent
interface when I create a component ?
What base class is being used to create the component? If
System.ComponentModel.Component or a descendant of that type is being
used, the IComponent interface is already implemented.

An example of how a class derived from System.Object implements
IComponent can be found at
http://msdn.microsoft.com/en-us/library/system.componentmodel.icomponent.aspx#Y717

regards
A.G.
 
A

Arne Vajhøj

I read a book and there is a pice of text that say the follwing.
"In strictest definition of a component in the .NET Framework, a component
must implement the System.ComponentModel.IComponent interface, which include
methods that can be called by other components to release no-longer used
system resources and to support integration with design tools."

I know that it works perfectly well to create a component without
implementing System.ComponentModel.IComponent interface.
So is the best practice to implement System.ComponentModel.IComponent
interface when I create a component ?

Depends on whether the components are to be used by
something that requires System.ComponentModel functionality.

If yes, then you should.

It is my impression that MS 1.x and 2.x stuff were
very much based on System.ComponentModel, but other stuff that
may replace its usage has been implemented in 3.x and 4.x - like
MAF and MEF.

Based on that I would not go the System.ComponentModel route
if I had a choice.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top