Bruno Peres
Bruno Peres

Reputation: 16375

Why am I getting "Invalid binary operator" warning when using modulus?

I'm developing a Xamarin Forms app in Visual Studio for Mac. I noticed that when I use the modulus operator (%) I'm receiving a warning saying "Invalid binary operator", as you can see in the image below:

Warning

maximum and step variables are doubles.

Despite this the value of x is correctly calculated after this line.

My question is: what does it mean and why Why am I getting this warning?

Upvotes: 0

Views: 227

Answers (2)

user47589
user47589

Reputation:

what does it mean

Nothing. It's incorrect. .Net supports modulus over doubles.

Why am I getting this warning?

This appears to be a defect in Xamarin. I would consider opening a ticket with them to solicit feedback from the development team.

https://github.com/mono/debugger-libs/blob/master/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs#L144

Upvotes: 1

twitort
twitort

Reputation: 313

The little warning appears to be in error. I get no such warning when doing the same thing in VS2015. Modulo, in C#, is defined and valid on all of the numeric types. See https://msdn.microsoft.com/en-us/library/h6zfzfy7(v=vs.100).aspx

Upvotes: 2

Related Questions