CollectionEditor.CreateInstance failure  
Author Message
eldiener





PostPosted: .NET Base Class Library, CollectionEditor.CreateInstance failure Top

I am creating my own collection editor for my own collection, deriving from System.ComponentModel.Design.CollectionEditor. I am attaching this collection it to a property of my collection in one of my components for design time editing of the collection.

In my collection editor I am overriding its CreateInstance method. This method can fail in my implementation of it. What do I do if it fails Do I throw an exception or do I put out a message box and return null


.NET Development37  
 
 
Sean Hederman





PostPosted: .NET Base Class Library, CollectionEditor.CreateInstance failure Top

Personally, I'd say throw an exception, and let the host (i.e. Visual Studio) handle it.



 
 
eldiener





PostPosted: .NET Base Class Library, CollectionEditor.CreateInstance failure Top

I subsequently saw that the documentation says to throw an exception but it does not say what type of exception to throw. I guess I will just pick one out that seems appropriate.