Hi there!

Hi there!
My name is Michael Ivanov and i'm a Senior SDE/Software architect.
My CV - here. You can find articles and other blog posts on the main page. I also develop some free and commercial software - complete list is here.

Monday, May 24, 2010

Never return!

Never return in the middle of the function.
Never return in the middle of the function.
Never return in the middle of the function.
Never return in the middle of the function.
Never return in the middle of the function.

If you don't want code behind return to be executed, rever conditions of return

Instead of
if(returnCondition) return yourValue;
/// some code


write
if(!returnCondition)
{
//// some code
}
return yourValue;


Never return in the middle of the function.

Wednesday, May 19, 2010

Test yourself.

Just a small task for you, try not to cheat and you ll get a pie :)
Show/Hide

Wednesday, May 5, 2010

just-in-mind: resharper doesn't look into false preprocessor directives

Suddenly noticed resharper doesn't look into preprocessor directives if they are false. For example, it counts such code as good:

var debugVariable = 0;
Console.WriteLine("This use the variable in output, " + debugVariable);
Console.WriteLine("And this is not");

Now, switch to "Release" configuration and add some preprocessor directives, to get a code like this:

var debugVariable = 0;
#if DEBUG
Console.WriteLine("This use the variable in output, " + debugVariable);
#else
Console.WriteLine("And this is not");
#endif

Resharper doesn't like it and it shows that variable debugVariable is never used.

Tuesday, May 4, 2010

Enterprise Library custom tracelistener to log to MS CRM

Hi to all. I hope this will be the first successfull entry in my blog.
It's devoted to a class i created recently in my current project. We plan to use Enterprise Library
in our projects and want our MS CRM users able to watch through the log entries via MS CRM. So my article describes
a process of creation custom listener for Enterprise Library that is able to write entries in MS CRM. I used
Enterpise library Beta 2 version, and it has poor documentation, so in several places i used a workaround code because
i failed to use all power of EL API for creating custom listener... So lets start!
Show/Hide