Click here to Skip to main content
15,890,336 members
Home / Discussions / C#
   

C#

 
AnswerRe: clearing up oledb command Pin
Andrew Rissing10-Nov-09 3:27
Andrew Rissing10-Nov-09 3:27 
GeneralRe: clearing up oledb command Pin
Andrew Rissing10-Nov-09 3:31
Andrew Rissing10-Nov-09 3:31 
GeneralRe: clearing up oledb command Pin
Md. Marufuzzaman10-Nov-09 5:46
professionalMd. Marufuzzaman10-Nov-09 5:46 
GeneralRe: clearing up oledb command Pin
PIEBALDconsult10-Nov-09 5:53
mvePIEBALDconsult10-Nov-09 5:53 
GeneralRe: clearing up oledb command Pin
Md. Marufuzzaman10-Nov-09 6:34
professionalMd. Marufuzzaman10-Nov-09 6:34 
GeneralRe: clearing up oledb command Pin
Md. Marufuzzaman10-Nov-09 6:36
professionalMd. Marufuzzaman10-Nov-09 6:36 
GeneralRe: clearing up oledb command Pin
PIEBALDconsult10-Nov-09 9:31
mvePIEBALDconsult10-Nov-09 9:31 
GeneralRe: clearing up oledb command Pin
Covean10-Nov-09 22:12
Covean10-Nov-09 22:12 
First you said.

Here you will find the reaturing value is updated;


result = "Entered try block."!

So what's wrong with this?


At next I said try and finally and not try and catch.
And whats the difference between try finally or using?
Both do the same!

Now to your statement "its not a good practice".
Whats wrong with the practice to cleanup everything
you allocated in an function?

Now one question:
Ever seen the limitations of the garbage-collector?
So it can be a good practice to collect the generation
zero (objects with a short lifetime cycle) in a
finally statement, if your objects eats up a large amounts of
memory, or the gc kills your performance!

At last one word to those crying out never catch something till the
exception reaches the gui layer.
This is wrong in general. Its right that you should not catch
everything and send it to nirvana but how about this? (pseudocode)

ConnectionObject con = null;
TransActionObject trans = null;
try
{
    con = new ConnectionToSomeDatabase(...);
    trans = new TransActionObject(con, ...);
    // do something
    trans.Commit();
    trans = null;
}
catch
{
    if(trans != null)
        trans.Rollback();
    throw;
}
finally
{
    if(con != null)
        con.Close();
}


How to implement something like this?
Whats the point not to use the given possibilities?

If somebody now says, its slow, then you are right
if you use this in a very fast loop, but how about
start a transaction on a database? There is not
comparision!

So just my 2 cent on this.
And yes I will continue make intensive use of this kind of
statements!

Greetings
Covean

QuestionNUnit execution from a share? Pin
Alaric_10-Nov-09 2:53
professionalAlaric_10-Nov-09 2:53 
QuestionHow to get the Left,Top and Height,Width of perticular region within an running application? Pin
ritz123410-Nov-09 2:50
ritz123410-Nov-09 2:50 
AnswerRe: How to get the Left,Top and Height,Width of perticular region within an running application? Pin
freakyit10-Nov-09 3:40
freakyit10-Nov-09 3:40 
GeneralRe: How to get the Left,Top and Height,Width of perticular region within an running application? Pin
ritz123410-Nov-09 17:43
ritz123410-Nov-09 17:43 
QuestionPIV Middleware Pin
shah zad10-Nov-09 2:36
shah zad10-Nov-09 2:36 
QuestionIcons Pin
Ersan Ercek10-Nov-09 2:13
Ersan Ercek10-Nov-09 2:13 
AnswerMessage Closed Pin
10-Nov-09 2:16
stancrm10-Nov-09 2:16 
GeneralRe: Icons Pin
Ersan Ercek10-Nov-09 6:12
Ersan Ercek10-Nov-09 6:12 
QuestionListView being buggy [modified] Pin
Xmen Real 10-Nov-09 1:53
professional Xmen Real 10-Nov-09 1:53 
AnswerMessage Closed Pin
10-Nov-09 2:01
stancrm10-Nov-09 2:01 
GeneralRe: ListView being buggy Pin
Xmen Real 10-Nov-09 2:03
professional Xmen Real 10-Nov-09 2:03 
GeneralMessage Closed Pin
10-Nov-09 2:07
stancrm10-Nov-09 2:07 
GeneralRe: ListView being buggy Pin
Xmen Real 10-Nov-09 2:08
professional Xmen Real 10-Nov-09 2:08 
QuestionC# WebBrowser control setting folder views window blank until right-click [modified] Pin
Wheels01210-Nov-09 1:50
Wheels01210-Nov-09 1:50 
QuestionConvert Office 2007 Word document to PDF document Pin
mayurp610-Nov-09 1:13
mayurp610-Nov-09 1:13 
AnswerRe: Convert Office 2007 Word document to PDF document Pin
Russ-T10-Nov-09 2:51
Russ-T10-Nov-09 2:51 
GeneralRe: Convert Office 2007 Word document to PDF document Pin
mayurp610-Nov-09 21:24
mayurp610-Nov-09 21:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.