|
Decimals in C# -- Brian --
Any ideas of why this gives me: "Error 1 'decimal.operator >=(decimal, decimal)': cannot explicitly call operator or accessor" decimal left = new decimal(123.45); decimal right = new decimal(22.22); Decimal.op_GreaterThanOrEqual(left, right); I'm just executing this in the main class. |
|
-- BradleyPeter --
You need to use: int i = Decimal.Compare( Left, Right ); (I think) Peter -----Original Message----- From: DotNetDevelopment on behalf of Brian Sent: Wed 7/12/2006 3:36 PM To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting Cc: Subject: Decimals in C# Any ideas of why this gives me: "Error 1 'decimal.operator >=(decimal, decimal)': cannot explicitly call operator or accessor" decimal left = new decimal(123.45); decimal right = new decimal(22.22); Decimal.op_GreaterThanOrEqual(left, right); I'm just executing this in the main class. |
|
-- Cerebrus --
I think it's simply because C# defines the >= operator on Decimal, while Visual Basic defines the op_GreaterThanOrEqual operator. The same code converted to VB will work. In any case, this is legacy VB, so you should use the Compare method as Peter suggested. |