where should this check logic go?

Posted by Benny on Stack Overflow See other posts from Stack Overflow or by Benny
Published on 2010-03-19T04:06:25Z Indexed on 2010/03/19 4:11 UTC
Read the original article Hit count: 192

Filed under:
|

I have a function that draw a string on graphics:

private void DrawSmallImage(Graphics g)
{
            if (this.SmallImage == null) return; 

            var smallPicHeight = this.Height / 5;

            var x = this.ClientSize.Width - smallPicHeight;
            var y = this.ClientSize.Height - smallPicHeight;

            g.DrawImage(this.SmallImage, x, y, smallPicHeight, smallPicHeight);
 }

the check if (this.SmallImage == null) return; should be in the function DrawSmallImage or should be in the caller? which is better?

© Stack Overflow or respective owner

Related posts about c#

Related posts about General