...

View Full Version : Operator Cannot be applied to operand



coxmg
11-05-2012, 07:40 PM
private double avgdailyprice = 1;

Print("Show this: " && avgdailyprice);

Fou-Lu
11-05-2012, 08:23 PM
What language; C#? && is the and operator, you cannot concat with that. Use + for string concatenation. I don't think the && exists in VB.NET; the & would be concat. Although I think that + is overloaded to work with strings in VB.NET as well, but I cannot recall.

alykins
11-05-2012, 09:48 PM
def not C# or VB

'Print' as it relates to the context is not a valid C# or VB method

coxmg
11-05-2012, 10:21 PM
its C#, thanks, the + worked.

Fou-Lu
11-05-2012, 10:43 PM
def not C# or VB

'Print' as it relates to the context is not a valid C# or VB method

Oh yeah good call. That'd be writeline in C#. Java could use print, but only off of a statically imported java.lang.System.out, and would still need out.print called on it.
Perhaps a custom method in place here.

sajjadaslam3
11-07-2012, 08:22 PM
You should write + sign for concatenation in C# like console.WriteLine("hello"+"World");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum