Hi,
As a follow up for my previous post, i have one more question:
Do following two examples differ in terms of optimization(execution + memory):
void Func1()
{
CUtil u = new CUtil(SomeDataBaseConnectionParams);
if (u.SomeDatabaseCheck())
{
DoWhatever();
}
}
vs
void Func2()
{
if ((new CUtil(SomeDataBaseConnectionParams)).SomeDatabaseC heck())
{
DoWhatever();
}
}
I don't see much difference, only one assignment operation more in the first case,
but the second case seems to me much more clear in terms of readability.
PS. No need to note about Dispose(), as this particuar class doesn't implement it. Database
disconnect occures in Finalizer.. Don't ask me why, that's just the way it was done long before me...
Any suggestions are appreciated!
Thank you,
Andrey