TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Operands of type 'decimal' and 'double'
Venkatesan Jayakantham
May 03, 2012
46.7
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Operator cannot be applied to operands of type 'decimal' and 'double'
Once I tried to compare my string with the a decimal value. I got an error indicating the decimal value cannot be compared.
(Convert.ToInt(txt_LowerBound.Text) < 0.001))... Resolved by changing the conversion
(Convert.ToDecimal(txt_LowerBound.Text) < 0.001))
Now, I got the next error message.
Operator '<' cannot be applied to operands of type decimal' and 'double'
The final change to get this condition work is as below,
(Convert.ToDecimal(txt_LowerBound.Text) < 0.001M))
Cheers,
Venkatesan Prabu .J
Head, KaaShiv InfoTech
Next Recommended Reading
What is Double Question mark operator (??) in C#