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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:46:58+00:00 2026-06-06T14:46:58+00:00

I am using c#. I have a method that outputs multiple values. I am

  • 0

I am using c#.

I have a method that outputs multiple values. I am aware of out but this is a reference type.
Is there anything equivalent to value type but that can also output multiple values from a method. With the reference type, the values are also changed outside of the method so I like to prevent.

    out
  • 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-06T14:46:59+00:00Added an answer on June 6, 2026 at 2:46 pm

    I am aware of out but this is a reference type.

    It’s not clear what you mean. out isn’t a type at all – it’s a decorator for parameters. You can use it with reference types or value types:

    // Nasty, but it does work...
    void SplitInTwo(string input, out string x1, out string x2, 
                    out int actualSplitCount)
    {
        string[] bits = input.Split('/');
        x1 = bits[0];
        x2 = bits[1];
        actualSplitCount = bits.Length;
    }
    

    So you can use out either way. However, I would strongly advise you not to do so. You can use the Tuple family of types for ad hoc multiple values, but if the returned values are actually related, you should consider encapsulating them into a separate type, and returning a value of that type.

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

Sidebar

Related Questions

I have a method that I'm using to output all the class names in
I have an .aspx file that outputs an image using the following methods: Server.MapPath(somefile.png)
I have a method that deletes a row form a database using the sql
Scenario I have a method that returns a list of processes using WMI. If
I'm using .NET 3.5. Say I have a method that accesses a specific file,
I'm using Java. I want to have a setter method of one class that
I have noticed that when using actionBar.setSelectedNavigationItem(x) in the onCreate() method of my Activity,
I have an interface that contains a single method called ListAll() using System.Collections.Generic; namespace
I have some XML that I want to parse using the lxml method in
I have just started spring, I found that somewhere we are using handlerequest() method

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.