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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:09:03+00:00 2026-05-15T17:09:03+00:00

The following code compiles in C# 4.0: void Foo(params string[] parameters) { } void

  • 0

The following code compiles in C# 4.0:

void Foo(params string[] parameters) { }
void Foo(string firstParameter, params string[] parameters) { }

How does the compiler know which overload you’re calling? And if it can’t, why does the code still compile?

  • 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-15T17:09:04+00:00Added an answer on May 15, 2026 at 5:09 pm

    It is well specified in the C# Language Specification, chapter 7.4.3.2, “Better function member”:

    Otherwise, if MP is applicable in its normal form and MQ has a params array and is applicable only in its expanded form, then MP is better than MQ

    Otherwise, if MP has fewer declared parameters than MQ, then MP is better than MQ. This can occur if both methods have params arrays and are applicable only in their expanded forms.

    Fwiw, the C# Language Specification is a very readable document and can help you resolve these puzzles by yourself. You have it on your machine, find it back in the Visual Studio install directory (like c:\program files\microsoft visual studio 9.0) in the vc#\specifications\1033 subdirectory.

    Another good one is the Ecma-335 standard document, freely available as a PDF download. It specifies the behavior of the CLR and the JIT compiler, great material to understand why C# (and the CLR) do what they do. Recommended.

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

Sidebar

Related Questions

I had the following code, which was basically, class foo { public: void method();
i have the following code snippet in my ANT File which compiles my project
I have the following code, which compiles but doesn't bring back any data. Here
I've got following code: File: Foo.h class Foo { friend void Bar(); }; File:
I saw the following snippet code: class Foo { public: void virtual func() throw
I have the following code: template<int k> void foo() { } int main(int argc,
When I compile the following code using g++ class A {}; void foo(A&) {}
I have the following code which compiles with no warnings (-Wall -pedantic) with g++
The following code compiles in MSVC++, but does not compile in GCC 4.5.1: #include
The following code throws std::bad_cast struct Foo { void foo () {} }; struct

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.