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 9254253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:25:17+00:00 2026-06-18T11:25:17+00:00

Here is what the WCF service is i want to get 5 values from

  • 0

Here is what the WCF service is i want to get 5 values from the users simultaneously and send them the response of addition of first two values as AddedResult, substraction of added result and third value as SubtractedResult, multiplication of SubtractedResult and fourth value as MultipliedResult and division of multipliedResult and 5th value as DividedResult.

I know this looks non-sense but i am trying to do some advance testings with these but i am new to WCF anyone who can help will really be appreciated.

public interface IService1
{

    [OperationContract]
    string GetValuesForCalculation(int value1, int value2, int value3, int value4, int value5);


    // TODO: Add your service operations here
}


public class Service1 : IService1
{

    public int GetValuesForCalculation(int value1, int value2, int value3, int value4, int value5)
    {
        int AddedResult;
        int SubtractedResult;
        int MultipliedResult;
        int DividedResult;

        AddedResult = (value1 + value2);
        SubtractedResult = (AddedResult - value3);
        MultipliedResult = (SubtractedResult - value4);
        DividedResult =(MultipliedResult/value5);

        return AddedResult;
        return SubtractedResult;
        return MultipliedResult;
        return DividedResult;
    }


}

How do I return 4 values at the same time?

  • 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-06-18T11:25:18+00:00Added an answer on June 18, 2026 at 11:25 am

    You need to make a DataContract and return that object.

    [ServiceContract()]
    interface IService1
    {
        [OperationContract]
        ReturnValue GetValuesForCalculation(int value1, int value2, int value3, int value4, int value5);
    }
    
    
    public class Service1 : IService1
    {
        public ReturnValue GetValuesForCalculation(int value1, int value2, int value3, int value4, int value5)
        {
            int AddedResult;
            int SubtractedResult;
            int MultipliedResult;
            int DividedResult;
    
            AddedResult = (value1 + value2);
            SubtractedResult = (AddedResult - value3);
            MultipliedResult = (SubtractedResult - value4);
            DividedResult =(MultipliedResult/value5);
    
            var returnValue = new ReturnValue(AddedResult, SubtractedResult, MultipliedResult,DividedResult); 
    
            return returnValue ;
        }
    }
    
    [DataContract]
    public class ReturnValue
    {
        public ReturnValue(int addedResult, int subtractedResult, int multipliedResult, int dividedResult)
        {
            AddedResult = addedResult;
            SubtractedResult = subtractedResult;
            MultipliedResult = multipliedResult;
            DividedResult = dividedResult;
        }
    
        [DataMember]
        public int AddedResult {get; set;}
    
        [DataMember]
        public int SubtractedResult {get; set;}
    
        [DataMember]
        public int MultipliedResult {get; set;}
    
        [DataMember]
        public int DividedResult {get; set;}
    }
    

    On your client side that ReturnValue class will be automatically generated by the same code that generates your client proxy (be it the tool built in to visual studio or svcutil.exe)

    Here is the MSDN Page on DataContracts.

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

Sidebar

Related Questions

I want to send a big XML string to a WCF SVC service from
I'm getting a List back from a WCF service and I want to set
I am trying to write my first WCF Service. Right now I just want
I'm creating a WCF service which I want to consume from a Java app.
Here is the problem: I have a WCF service and a few sites connecting
Here and here it is written how to convert a standard WCF Service to
Here is the situation: Silverlight 3 Application hits an asp.net hosted WCF service to
Here is the scenario, I have a WCF service call that takes one string
I'm setting up a net.tcp WCF service using instructions here: http://blogs.msdn.com/swiss_dpe_team/archive/2008/02/08/iis-7-support-for-non-http-protocols.aspx One of the
Here is my situation. I have written a WCF service which calls into one

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.