A list of all interfaces in .net 3.5SP1

A

Andy B.

I want to make some wise choices when making my objects. I want to add
features to them, but don't feel like writing my own interfaces if they
already exist. Since I don't totally know what's out there in .net 3.5sp1 as
far as interfaces go, is there a simple easy way to find a list of them
somewhere? I would need them from msdn if possible.
 
F

Family Tree Mike

I want to make some wise choices when making my objects. I want to add
features to them, but don't feel like writing my own interfaces if they
already exist. Since I don't totally know what's out there in .net 3.5sp1 as
far as interfaces go, is there a simple easy way to find a list of them
somewhere? I would need them from msdn if possible.

The only place I would trust would be MSDN. All the namespaces list on
their main page, the classes, structures, and interfaces that are
defined in the namespace. You need to identify what namespace might
have appropriate interfaces for your objects. For example, if your
class does something with multiple objects, you would likely look at
System.Collections:
http://msdn.microsoft.com/en-us/library/system.collections.aspx
 
A

Andy B.

Family Tree Mike said:
The only place I would trust would be MSDN. All the namespaces list on
their main page, the classes, structures, and interfaces that are defined
in the namespace. You need to identify what namespace might have
appropriate interfaces for your objects. For example, if your class does
something with multiple objects, you would likely look at
System.Collections:
http://msdn.microsoft.com/en-us/library/system.collections.aspx

Got that part, but is there a way to list only the interfaces?
 
C

Cor Ligthert[MVP]

Andy,

I can not imagine a situation where you would use an existing interface
(from Net) except for non inheritable classes.

If you want to create classes from already existing classes then you use
those classes as a base class.
Those then already implement those interfaces.

It seems that somehow interfaces have blinded you.

Cor
 
F

Family Tree Mike

Andy,

I can not imagine a situation where you would use an existing interface
(from Net) except for non inheritable classes.

If you want to create classes from already existing classes then you use
those classes as a base class.
Those then already implement those interfaces.

It seems that somehow interfaces have blinded you.

Cor

System.IComparable might be an exception to this. There is often good
reason to impliment this interface.
 
M

Michel Posseth [MCP]

Family Tree Mike said:
System.IComparable might be an exception to this. There is often good
reason to impliment this interface.

Many developers fail to grasp the importance of interfaces and don`t
leverage there full potential
System.IComparable might be an exception to this. There is often good
reason to impliment this interface.

Well ,,,,, what about IComparable , IComparer, ICloneable, IDisposable ,
IEnumerable and IEnumerate .... ????


regards
Michel
 
F

Family Tree Mike

Many developers fail to grasp the importance of interfaces and don`t
leverage there full potential


Well ,,,,, what about IComparable , IComparer, ICloneable, IDisposable ,
IEnumerable and IEnumerate .... ????


regards
Michel

Absolutly right. IComparable was the one that jumped out at me as obvious.
 
M

Mark Hurd

Andy B. said:
I want to make some wise choices when making my objects. I want to add
features to them, but don't feel like writing my own interfaces if they
already exist. Since I don't totally know what's out there in .net
3.5sp1 as far as interfaces go, is there a simple easy way to find a
list of them somewhere? I would need them from msdn if possible.

Using DotLisp I enumerated all public interfaces from these assemblies:

"Accessibility, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
"Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
"mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System.Configuration, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
"System.Core, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System.Data.Linq, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System.Data.SqlXml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
"System.Security, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
"System.Transactions, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
"System.Xml.Linq, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"

ordered by the interface name:

"System.Runtime.InteropServices._Activator"
"System._AppDomain"
"System.Runtime.InteropServices._Assembly"
"System.Runtime.InteropServices._AssemblyBuilder"
"System.Runtime.InteropServices._AssemblyName"
"System.Runtime.InteropServices._Attribute"
"System.Runtime.InteropServices._ConstructorBuilder"
"System.Runtime.InteropServices._ConstructorInfo"
"System.Runtime.InteropServices._CustomAttributeBuilder"
"System.Runtime.InteropServices._EnumBuilder"
"System.Runtime.InteropServices._EventBuilder"
"System.Runtime.InteropServices._EventInfo"
"System.Runtime.InteropServices._Exception"
"System.Runtime.InteropServices._FieldBuilder"
"System.Runtime.InteropServices._FieldInfo"
"System.Runtime.InteropServices._ILGenerator"
"System.Runtime.InteropServices._LocalBuilder"
"System.Runtime.InteropServices._MemberInfo"
"System.Runtime.InteropServices._MethodBase"
"System.Runtime.InteropServices._MethodBuilder"
"System.Runtime.InteropServices._MethodInfo"
"System.Runtime.InteropServices._MethodRental"
"System.Runtime.InteropServices._Module"
"System.Runtime.InteropServices._ModuleBuilder"
"System.Runtime.InteropServices._ParameterBuilder"
"System.Runtime.InteropServices._ParameterInfo"
"System.Runtime.InteropServices._PropertyBuilder"
"System.Runtime.InteropServices._PropertyInfo"
"System.Runtime.InteropServices._SignatureHelper"
"System.Runtime.InteropServices._Thread"
"System.Runtime.InteropServices._Type"
"System.Runtime.InteropServices._TypeBuilder"
"Accessibility.CAccPropServices"
"Accessibility.IAccessible"
"Accessibility.IAccessibleHandler"
"Accessibility.IAccIdentity"
"Accessibility.IAccPropServer"
"Accessibility.IAccPropServices"
"System.Runtime.Remoting.Activation.IActivator"
"System.Runtime.InteropServices.ComTypes.IAdviseSink"
"System.IAppDomainSetup"
"System.Configuration.IApplicationSettingsProvider"
"System.Security.Policy.IApplicationTrustManager"
"System.IAsyncResult"
"System.Net.IAuthenticationModule"
"Microsoft.SqlServer.Server.IBinarySerialize"
"System.Windows.Forms.IBindableComponent"
"System.Runtime.InteropServices.ComTypes.IBindCtx"
"System.ComponentModel.IBindingList"
"System.ComponentModel.IBindingListView"
"System.Windows.Forms.IButtonControl"
"System.ComponentModel.ICancelAddNew"
"System.Net.ICertificatePolicy"
"System.ComponentModel.IChangeTracking"
"System.Runtime.Remoting.Channels.IChannel"
"System.Runtime.Remoting.Channels.IChannelDataStore"
"System.Runtime.Remoting.IChannelInfo"
"System.Runtime.Remoting.Channels.IChannelReceiver"
"System.Runtime.Remoting.Channels.IChannelReceiverHook"
"System.Runtime.Remoting.Channels.IChannelSender"
"System.Runtime.Remoting.Channels.IChannelSinkBase"
"System.Runtime.Remoting.Channels.IClientChannelSink"
"System.Runtime.Remoting.Channels.IClientChannelSinkProvider"
"System.Runtime.Remoting.Channels.IClientChannelSinkStack"
"System.Runtime.Remoting.Channels.IClientFormatterSink"
"System.Runtime.Remoting.Channels.IClientFormatterSinkProvider"
"System.Runtime.Remoting.Channels.IClientResponseChannelSinkStack"
"System.ICloneable"
"System.CodeDom.Compiler.ICodeCompiler"
"System.CodeDom.Compiler.ICodeGenerator"
"System.CodeDom.Compiler.ICodeParser"
"System.Diagnostics.ICollectData"
"System.Collections.ICollection"
"System.Collections.Generic.ICollection`1"
"System.Data.IColumnMapping"
"System.Data.IColumnMappingCollection"
"System.Windows.Forms.ComponentModel.Com2Interop.ICom2PropertyPageDisplayService"
"System.Windows.Forms.ICommandExecutor"
"System.ComponentModel.IComNativeDescriptorHandler"
"System.IComparable"
"System.IComparable`1"
"System.Collections.IComparer"
"System.Collections.Generic.IComparer`1"
"System.ComponentModel.IComponent"
"System.ComponentModel.Design.IComponentChangeService"
"System.ComponentModel.Design.IComponentDiscoveryService"
"System.Windows.Forms.IComponentEditorPageSite"
"System.ComponentModel.Design.IComponentInitializer"
"System.Windows.Forms.ComponentModel.Com2Interop.IComPropertyBrowser"
"System.Configuration.Internal.IConfigErrorInfo"
"System.Configuration.Internal.IConfigSystem"
"System.Configuration.Internal.IConfigurationManagerHelper"
"System.Configuration.Internal.IConfigurationManagerInternal"
"System.Configuration.IConfigurationSectionHandler"
"System.Configuration.IConfigurationSystem"
"System.Runtime.InteropServices.ComTypes.IConnectionPoint"
"System.Runtime.InteropServices.ComTypes.IConnectionPointContainer"
"System.Runtime.Remoting.Activation.IConstructionCallMessage"
"System.Runtime.Remoting.Activation.IConstructionReturnMessage"
"System.ComponentModel.IContainer"
"System.Windows.Forms.IContainerControl"
"System.Runtime.Remoting.Contexts.IContextAttribute"
"System.Runtime.Remoting.Contexts.IContextProperty"
"System.Runtime.Remoting.Contexts.IContextPropertyActivator"
"System.Runtime.Remoting.Contexts.IContributeClientContextSink"
"System.Runtime.Remoting.Contexts.IContributeDynamicSink"
"System.Runtime.Remoting.Contexts.IContributeEnvoySink"
"System.Runtime.Remoting.Contexts.IContributeObjectSink"
"System.Runtime.Remoting.Contexts.IContributeServerContextSink"
"System.IConvertible"
"System.Net.ICredentialPolicy"
"System.Net.ICredentials"
"System.Net.ICredentialsByHost"
"System.Security.Cryptography.ICryptoTransform"
"System.Security.Cryptography.ICspAsymmetricAlgorithm"
"System.Windows.Forms.ICurrencyManagerProvider"
"System.Runtime.InteropServices.ICustomAdapter"
"System.Reflection.ICustomAttributeProvider"
"System.Runtime.InteropServices.ICustomFactory"
"System.ICustomFormatter"
"System.Runtime.InteropServices.ICustomMarshaler"
"System.ComponentModel.ICustomTypeDescriptor"
"System.Data.IDataAdapter"
"System.ComponentModel.IDataErrorInfo"
"System.Windows.Forms.IDataGridColumnStyleEditingNotificationService"
"System.Windows.Forms.IDataGridEditingService"
"System.Windows.Forms.IDataGridViewEditingCell"
"System.Windows.Forms.IDataGridViewEditingControl"
"System.Runtime.InteropServices.ComTypes.IDataObject"
"System.Windows.Forms.IDataObject"
"System.Data.IDataParameter"
"System.Data.IDataParameterCollection"
"System.Data.IDataReader"
"System.Data.IDataRecord"
"System.Data.IDbCommand"
"System.Data.IDbConnection"
"System.Data.IDbDataAdapter"
"System.Data.IDbDataParameter"
"System.Data.IDbTransaction"
"System.Runtime.Serialization.IDeserializationCallback"
"System.ComponentModel.Design.IDesigner"
"System.ComponentModel.Design.IDesignerEventService"
"System.ComponentModel.Design.IDesignerFilter"
"System.ComponentModel.Design.IDesignerHost"
"System.ComponentModel.Design.IDesignerHostTransactionState"
"System.ComponentModel.Design.Serialization.IDesignerLoaderHost"
"System.ComponentModel.Design.Serialization.IDesignerLoaderHost2"
"System.ComponentModel.Design.Serialization.IDesignerLoaderService"
"System.ComponentModel.Design.IDesignerOptionService"
"System.ComponentModel.Design.Serialization.IDesignerSerializationManager"
"System.ComponentModel.Design.Serialization.IDesignerSerializationProvider"
"System.ComponentModel.Design.Serialization.IDesignerSerializationService"
"System.Drawing.IDeviceContext"
"System.Collections.IDictionary"
"System.Collections.Generic.IDictionary`2"
"System.Collections.IDictionaryEnumerator"
"System.ComponentModel.Design.IDictionaryService"
"System.IDisposable"
"System.Windows.Forms.IDropTarget"
"System.Transactions.IDtcTransaction"
"System.Runtime.Remoting.Contexts.IDynamicMessageSink"
"System.Runtime.Remoting.Contexts.IDynamicProperty"
"System.ComponentModel.IEditableObject"
"System.Transactions.IEnlistmentNotification"
"System.Runtime.InteropServices.ComTypes.IEnumConnectionPoints"
"System.Runtime.InteropServices.ComTypes.IEnumConnections"
"System.Collections.IEnumerable"
"System.Collections.Generic.IEnumerable`1"
"System.Collections.IEnumerator"
"System.Collections.Generic.IEnumerator`1"
"System.Runtime.InteropServices.ComTypes.IEnumFORMATETC"
"System.Runtime.InteropServices.ComTypes.IEnumMoniker"
"System.Runtime.InteropServices.ComTypes.IEnumSTATDATA"
"System.Runtime.InteropServices.ComTypes.IEnumString"
"System.Runtime.InteropServices.ComTypes.IEnumVARIANT"
"System.Runtime.Remoting.IEnvoyInfo"
"System.Collections.IEqualityComparer"
"System.Collections.Generic.IEqualityComparer`1"
"System.IEquatable`1"
"System.ComponentModel.Design.IEventBindingService"
"System.Security.IEvidenceFactory"
"System.Data.Linq.IExecuteResult"
"System.Runtime.InteropServices.Expando.IExpando"
"System.ComponentModel.Design.IExtenderListService"
"System.ComponentModel.IExtenderProvider"
"System.ComponentModel.Design.IExtenderProviderService"
"System.Windows.Forms.IFeatureSupport"
"System.Runtime.Serialization.Formatters.IFieldInfo"
"System.Windows.Forms.IFileReaderService"
"System.IFormatProvider"
"System.IFormattable"
"System.Runtime.Serialization.IFormatter"
"System.Runtime.Serialization.IFormatterConverter"
"System.Data.Linq.IFunctionResult"
"System.Linq.IGrouping`2"
"System.Collections.IHashCodeProvider"
"System.Xml.IHasXmlNode"
"System.ComponentModel.Design.IHelpService"
"System.Security.Principal.IIdentity"
"System.Security.Policy.IIdentityPermissionFactory"
"System.ComponentModel.Design.IInheritanceService"
"System.ComponentModel.IIntellisenseBuilder"
"System.Configuration.Internal.IInternalConfigClientHost"
"System.Configuration.Internal.IInternalConfigConfigurationFactory"
"System.Configuration.Internal.IInternalConfigHost"
"System.Configuration.Internal.IInternalConfigRecord"
"System.Configuration.Internal.IInternalConfigRoot"
"System.Configuration.Internal.IInternalConfigSettingsFactory"
"System.Configuration.Internal.IInternalConfigSystem"
"System.Runtime.Remoting.Lifetime.ILease"
"System.Collections.IList"
"System.Collections.Generic.IList`1"
"System.ComponentModel.IListSource"
"System.Runtime.Remoting.Messaging.ILogicalThreadAffinative"
"System.Linq.ILookup`2"
"System.Security.Policy.IMembershipCondition"
"System.ComponentModel.Design.IMenuCommandService"
"System.Runtime.Remoting.Messaging.IMessage"
"System.Runtime.Remoting.Messaging.IMessageCtrl"
"System.Windows.Forms.IMessageFilter"
"System.Runtime.Remoting.Messaging.IMessageSink"
"System.Runtime.Remoting.Messaging.IMethodCallMessage"
"System.Runtime.Remoting.Messaging.IMethodMessage"
"System.Runtime.Remoting.Messaging.IMethodReturnMessage"
"System.Runtime.InteropServices.ComTypes.IMoniker"
"System.Data.Linq.IMultipleResults"
"System.ComponentModel.Design.Serialization.INameCreationService"
"System.ComponentModel.INestedContainer"
"System.ComponentModel.INestedSite"
"System.IO.IsolatedStorage.INormalizeForIsolatedStorage"
"System.ComponentModel.INotifyPropertyChanged"
"System.ComponentModel.INotifyPropertyChanging"
"System.Data.SqlTypes.INullable"
"System.Runtime.Remoting.IObjectHandle"
"System.Runtime.Serialization.IObjectReference"
"System.Collections.Specialized.IOrderedDictionary"
"System.Linq.IOrderedEnumerable`1"
"System.Linq.IOrderedQueryable"
"System.Linq.IOrderedQueryable`1"
"System.Security.IPermission"
"System.Configuration.IPersistComponentSettings"
"System.Runtime.InteropServices.ComTypes.IPersistFile"
"System.Security.Principal.IPrincipal"
"System.Transactions.IPromotableSinglePhaseNotification"
"System.Drawing.Design.IPropertyValueUIService"
"System.Linq.IQueryable"
"System.Linq.IQueryable`1"
"System.Linq.IQueryProvider"
"System.ComponentModel.IRaiseItemChangedEvents"
"System.ComponentModel.Design.IReferenceService"
"System.Reflection.IReflect"
"System.Runtime.InteropServices.IRegistrationServices"
"System.Security.Cryptography.Xml.IRelDecryptor"
"System.Runtime.Remoting.Messaging.IRemotingFormatter"
"System.Runtime.Remoting.IRemotingTypeInfo"
"System.Resources.IResourceReader"
"System.ComponentModel.Design.IResourceService"
"System.Resources.IResourceWriter"
"System.ComponentModel.IRevertibleChangeTracking"
"System.ComponentModel.Design.IRootDesigner"
"System.Windows.Forms.PropertyGridInternal.IRootGridEntry"
"System.Runtime.InteropServices.ComTypes.IRunningObjectTable"
"System.Runtime.Remoting.Channels.ISecurableChannel"
"System.Security.ISecurityEncodable"
"System.Security.ISecurityPolicyEncodable"
"System.ComponentModel.Design.ISelectionService"
"System.Runtime.Serialization.ISerializable"
"System.Runtime.Serialization.ISerializationSurrogate"
"System.Runtime.Remoting.Channels.IServerChannelSink"
"System.Runtime.Remoting.Channels.IServerChannelSinkProvider"
"System.Runtime.Remoting.Channels.IServerChannelSinkStack"
"System.Runtime.Remoting.Channels.IServerFormatterSinkProvider"
"System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack"
"System.ComponentModel.Design.IServiceContainer"
"System.IServiceProvider"
"System.Configuration.ISettingsProviderService"
"System.Transactions.ISimpleTransactionSuperior"
"System.Transactions.ISinglePhaseNotification"
"System.Data.Linq.ISingleResult`1"
"System.ComponentModel.ISite"
"System.Runtime.Serialization.Formatters.ISoapMessage"
"System.Runtime.Remoting.Metadata.W3cXsd2001.ISoapXsd"
"System.Runtime.Remoting.Lifetime.ISponsor"
"System.Security.IStackWalk"
"System.Runtime.InteropServices.ComTypes.IStream"
"System.Runtime.CompilerServices.IStrongBox"
"System.ComponentModel.ISupportInitialize"
"System.ComponentModel.ISupportInitializeNotification"
"System.Runtime.Serialization.ISurrogateSelector"
"System.Diagnostics.SymbolStore.ISymbolBinder"
"System.Diagnostics.SymbolStore.ISymbolBinder1"
"System.Diagnostics.SymbolStore.ISymbolDocument"
"System.Diagnostics.SymbolStore.ISymbolDocumentWriter"
"System.Diagnostics.SymbolStore.ISymbolMethod"
"System.Diagnostics.SymbolStore.ISymbolNamespace"
"System.Diagnostics.SymbolStore.ISymbolReader"
"System.Diagnostics.SymbolStore.ISymbolScope"
"System.Diagnostics.SymbolStore.ISymbolVariable"
"System.Diagnostics.SymbolStore.ISymbolWriter"
"System.ComponentModel.ISynchronizeInvoke"
"System.Data.Linq.ITable"
"System.Data.ITableMapping"
"System.Data.ITableMappingCollection"
"System.Drawing.Design.IToolboxItemProvider"
"System.Drawing.Design.IToolboxService"
"System.Drawing.Design.IToolboxUser"
"System.Runtime.Remoting.Services.ITrackingHandler"
"System.Transactions.ITransactionPromoter"
"System.Runtime.Remoting.Channels.ITransportHeaders"
"System.ComponentModel.Design.ITreeDesigner"
"System.Runtime.InteropServices.ComTypes.ITypeComp"
"System.ComponentModel.ITypeDescriptorContext"
"System.ComponentModel.Design.ITypeDescriptorFilterService"
"System.ComponentModel.Design.ITypeDiscoveryService"
"System.ComponentModel.ITypedList"
"System.Runtime.InteropServices.ComTypes.ITypeInfo"
"System.Runtime.InteropServices.ComTypes.ITypeInfo2"
"System.Runtime.InteropServices.ComTypes.ITypeLib"
"System.Runtime.InteropServices.ComTypes.ITypeLib2"
"System.Runtime.InteropServices.ITypeLibConverter"
"System.Runtime.InteropServices.ITypeLibExporterNameProvider"
"System.Runtime.InteropServices.ITypeLibExporterNotifySink"
"System.Runtime.InteropServices.ITypeLibImporterNotifySink"
"System.ComponentModel.Design.ITypeResolutionService"
"System.Windows.Forms.Design.IUIService"
"System.Security.Permissions.IUnrestrictedPermission"
"Microsoft.VisualBasic.CompilerServices.IVbHost"
"System.Net.IWebProxy"
"System.Net.IWebProxyScript"
"System.Net.IWebRequestCreate"
"System.Windows.Forms.IWin32Window"
"System.Windows.Forms.Design.IWindowsFormsEditorService"
"System.Windows.Forms.IWindowTarget"
"System.Xml.IXmlLineInfo"
"System.Xml.IXmlNamespaceResolver"
"System.Xml.Schema.IXmlSchemaInfo"
"System.Xml.Serialization.IXmlSerializable"
"System.Xml.Serialization.IXmlTextParser"
"System.Xml.XPath.IXPathNavigable"
"System.Xml.Xsl.IXsltContextFunction"
"System.Xml.Xsl.IXsltContextVariable"
"System.Runtime.InteropServices.UCOMIBindCtx"
"System.Runtime.InteropServices.UCOMIConnectionPoint"
"System.Runtime.InteropServices.UCOMIConnectionPointContainer"
"System.Runtime.InteropServices.UCOMIEnumConnectionPoints"
"System.Runtime.InteropServices.UCOMIEnumConnections"
"System.Runtime.InteropServices.UCOMIEnumMoniker"
"System.Runtime.InteropServices.UCOMIEnumString"
"System.Runtime.InteropServices.UCOMIEnumVARIANT"
"System.Runtime.InteropServices.UCOMIMoniker"
"System.Runtime.InteropServices.UCOMIPersistFile"
"System.Runtime.InteropServices.UCOMIRunningObjectTable"
"System.Runtime.InteropServices.UCOMIStream"
"System.Runtime.InteropServices.UCOMITypeComp"
"System.Runtime.InteropServices.UCOMITypeInfo"
"System.Runtime.InteropServices.UCOMITypeLib"

It is clearly more than you wanted to know, but I thought I should post
it anyway.
 
J

James Hahn

It is worthwhile using an existing interface if it's suitable. But the
process would operate the other way around to the way you seem to be
thinking. You would implement an interface in your objects if you needed
the functionality that you get by creating that implementation.

That is, if you would like the functionality of sorting your objects when
they are part of an array, implement IComparable. As soon as you do that,
the sorting functionality that already exists for the array class is
available to (or at least makes sense for) arrays of your objects. If you
have no need to sort your objects in any particular order, even if you are
handling them in arrays, don't implement the interface.

So what you do or don't implement in your objects is going to be driven by
the functionality you would like to use in other objects when they are
manipulating or referencing or somehow handling your objects.

So there's not really a need to know all the interfaces. But you do need to
look at what framework objects you are using with your objects, check what
interfaces the support, and see whether implementing an interface for your
objects is going to give you more or better functionality when you use them
with those framework objects.
 
A

Andy B.

I thought you had to actually write the code for the interface. If you
implement IComparable, then you need to write your own custom code to make
the methods work.
 
F

Family Tree Mike

Andy B. said:
I thought you had to actually write the code for the interface. If you
implement IComparable, then you need to write your own custom code to make
the methods work.

Andy,

Yes you need to write the code behind the interface. What Jim is saying is
that the Sort methods of the Collection datatypes depend on the objects
implimenting IComparable. This means, if you want your classes instances to
be sorted correctly, then you impliment the interface. If you don't so much
care how they are sorted, then you don't need to impliment the inteface.

Mike
 

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