Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Proper way to stop New() execution
Message
From
31/10/2006 17:40:13
Keith Payne
Technical Marketing Solutions
Florida, United States
 
General information
Forum:
ASP.NET
Category:
Class design
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01165405
Message ID:
01165978
Views:
14
>Throwing exceptions will give you that same functionality but I personally think that object instantiation should always work unless there's truly an exceptional failure.

Rick is absolutely right. Many developers write code that instantiates the object at the same time it is declared.
Dim myObj as New myClass(1, True)
myClass myObj = new myClass(1, true);
And a lot of this kind of code is outside of a try/catch block so any exceptions in the constructor will probably get bubbled up higher than intended.
Previous
Reply
Map
View

Click here to load this message in the networking platform