Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6657793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:48:52+00:00 2026-05-26T01:48:52+00:00

I have this error that I am tying to solve. Visual Studio 2010 gives

  • 0

I have this error that I am tying to solve.

Visual Studio 2010 gives the error as:

operator '-' cannot be applied to operands of type 'decimal' and 'Systems.Collections.Generic.IEnumerable<decimal>

My Code:

// Step 5: Retrieve MPR amount and deduct form Gross Tax Dictionary Per-Employee

                //Query database
                var taxtable = taxTableService.GetAllTaxTables();

                var mprAmount = (from tt in taxtable select tt.U_MPR_amount).Distinct();

                Dictionary<int, decimal> paye = new Dictionary<int, decimal>();

                grossTaxDictionary.ToList().ForEach(x =>
                {
                    var totalPAYE = x.Value - mprAmount;

                    paye.Add(x.Key, totalPAYE);

                });

In my database, the field U_MPR_amount is a decimal and so is x.Value.

Error shows up on the line x.Value - mprAmount;

What could be the problem? Any help appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:48:52+00:00Added an answer on May 26, 2026 at 1:48 am

    According to your code, mprAmount is a list, you cannot subtract it from a single value.

    If you are certain that the list contains just a single element then you can retrieve it using the Single method:

    var totalPAYE = x.Value - mprAmount.Single();
    

    Or, more likely:

    var mprAmount = (from tt in taxtable select tt.U_MPR_amount).Single();
    

    Notice that I’ve changed Distinct for Single. Using both makes no real sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this error that is keeping me from moving forward. I basically have
Hi have made this function which is made to replicate an error that I
This is probably a setting error somewhere. I have a django app that works
Been trying to solve this error for ages now, hoping that someone here can
I tried to have Visual Studio 2010 create unit tests for the following class,
I have an problem in Visual Studio 2010: I created an custom user control,
I have a macro that looks like this: #define coutError if (VERBOSITY_SETTING >= VERBOSITY_ERROR)
I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide
I install plugin open_id_authentication and have this error: /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require': no such file to
I wonder if anyone can help - I have this error showing recently when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.