15,901,426 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Tomáš Vepřek (Top 5 by date)
Tomáš Vepřek
14-Jun-11 3:16am
View
Deleted
Aye i wouldnt want that.
Tomáš Vepřek
10-Jun-11 3:47am
View
Deleted
Well take for example a WCF service and ServiceHost object. This object doesnt implement dispose but you have to close it or call abort. The use of catch block in finally here is that abort and close both can raise and exception but you want to call them always. Its just an example, i just want to say that there always can be code where you may have to catch exception in dispose or finally block.
Tomáš Vepřek
8-Jun-11 4:05am
View
Deleted
I agree that in scenario where you want whole code in try catch block like this: try { }catch{} finally {} it wont be shorter but if you need this try{} finally { try{ } catch{} } or just plain try{ }finally and let some other code in callstack handle exception i think it may have some use.
As i posted earlier you can put try catch block from finally into dispose method of Finalizer and make it much more reusable.
Tomáš Vepřek
8-Jun-11 4:00am
View
Deleted
Well think of what you can do with this, you can for example make some big try catch block in dispose method for example :
try
{
if (Action != null)
Action.DynamicInvoke();
}
catch(NullreferenceException)
{
}
catch(FileNotFoundException)
{
}
I think you'll get the idea. And using this you will shorten the final code and have some business logic inside Finalizer.
Tomáš Vepřek
8-Jun-11 3:57am
View
Deleted
Well this is exactly what i wanted to hear :)
I dont want to catch the exception, i want the caller to get it and do whatever he likes with it. Caller will know that something went wrong what makes you think he doesnt ? Exception still occures and its up to him to catch it but maybe not on the level where he calls this method.
The idea was to make same functionality with different syntax.