Monday, January 18, 2010

lblBuildInfo.Text = "Build " + BuildDate.ToShortDateString;

Operator '+' cannot be applied to operands of type 'string' and 'method group'

This is happening with some vb.net code I pushed through a converter to c#. Being lazy sometimes has it's benefits, but not here.

Hmm, syntactically these looks correct, but there's a little more to it.

vb.net is nonchalant about functions ending in a paren pair (). c# is not. The converter did not even bother telling me this was a problem, and took my code.

lblBuildInfo.Text = "Build " + BuildDate.ToShortDateString();

Is correct.

No comments:

Post a Comment