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

  • Home
  • SEARCH
  • 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 3616298
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:28:55+00:00 2026-05-18T22:28:55+00:00

In PHP you can write $arr = array(1,2); list($a, $b) = $arr; Which is

  • 0

In PHP you can write

$arr = array(1,2);
list($a, $b) = $arr;

Which is basically the equivalent of

$a = $arr[0];
$b = $arr[1];

Is there an equivalent in C#?


Just bugs me because so often I write things like

var split = action.Split('.');
string controllerName = split[0];
string actionName = split[1];

And split is just a throw-away variable that I can never think of a decent name for. “chunks”, “bits”, “pieces”, “parts”,… all meaningless jibberish.

  • 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-18T22:28:56+00:00Added an answer on May 18, 2026 at 10:28 pm

    You could write your own method, like:

    int[] arr = new[] { 1, 2 };
    
    int a, b;
    Populate(arr, out a, out b);
    
    static void Populate<T>(T[] arr, out T t1, out T t2)
    {
        t1 = arr[0];
        t2 = arr[1];
    }
    

    I wouldn’t recommend it, though…You’d have to be careful about having the right number of parameters, and I don’t think there’s a way to do an arbitrary size – C# has the concept of “params array” in the signature, but I don’t think you can do it with “out” parameters.

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

Sidebar

Related Questions

In PHP, I can write: $vname = 'phone'; $$vname = '555-1234'; print $phone; ...
How can you allow a PHP script to write to a file with high-security
In PHP I can name my array indices so that I may have something
A PHP array can have arrays for its elements. And those arrays can have
Can a PHP script (which can be working with a MySQL DB) send and/or
i want to know how i can write php function in c (like strtoupper
I would like to know how one can write PHP code to read filenames
Possible Duplicate: Unpythonic way of printing variables in Python? In PHP one can write:
The PHP documentation can be found here , but I think it's rather lacking.
In PHP you can access characters of strings in a few different ways, 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.