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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:22:43+00:00 2026-05-31T07:22:43+00:00

Short Version : A named argument following an out argument gives a compiler error,

  • 0

Short Version: A named argument following an out argument gives a compiler error, but I cannot find any support for this behaviour in the language specification.

Long Version:

I’m using the Enum.TryParse<TEnum> three parameter overload, but I would prefer to name the ignoreCase parameter to make my code clearer, a call like:

MyEnum res;
b = Enum.TryParse<MyEnum>(inputString, true, out res);

leaves the meaning of the boolean unclear (unless this method is known1). Hence I would like to use:

b = Enum.TryParse<MyEnum>(inputString, out res, ignoreCase: true);

However the compiler reports this as an error:

Named argument ‘ignoreCase’ specifies a parameter for which a positional argument has already been given

and the IDE highlights the ignoreCase parameter. VS2010 targeting .NET 4, and VS11 Beta targeting either 4 or 4.5 all give the same result. In all cases naming the out parameter removes the error.

b = Enum.TryParse<MyEnum>(inputString, result: out res, ignoreCase: true);

I’ve tried this across a number of different methods (including avoiding generics)2, both from the framework and in my assembly: always the same result: an out parameter followed by a named parameter gives an error.

I can see no reason for this error, and §7.5.1 Argument Lists of the C# Language Specification: Version 4.0 does not seem to provide any reason why an out followed by a named parameter should give an error. The text of the error seems to support an interpretation as a bug: there is no positional argument which could be a valid match for ignoreCase.

Is my reading of the specification wrong? Or is this a compiler bug?

C# 7.2 Update

This restriction on all named arguments have to follow positional arguments when calling was lifted with C# 7.2.

See https://learn.microsoft.com/en-gb/dotnet/csharp/whats-new/csharp-7-2#non-trailing-named-arguments.


1 Hence the advice in the Framework Design Guidelines to prefer enum parameters.

2 Eg: given:

private static void TestMethod(int one, float two, out string three) {
  three = "3333";
}

this this call also gives the same error on the named parameter unless the out parameter is also named:

TestMethod(1, out aString, two: 1.0f);
  • 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-31T07:22:44+00:00Added an answer on May 31, 2026 at 7:22 am

    Named parameters do not allow you to “skip” positional arguments.

    Your code is parsed as passing the first two arguments—value and ignoreCase, then passing ignoreCase again.
    It has nothing to do with the outness of the parameter.

    You can fix it by passing the last parameter as named too.

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

Sidebar

Related Questions

Short version : echo testing | vim - | grep good This doesn't work
I feel like a dork just for asking this, but I'm not getting any
Super-short version: I solved this problem when I was nearly finished writing the question.
The short version of this question is: How can I take data that only
Short version: How do I write this query in squeel? SELECT OneTable.*, my_count FROM
Short version: When I try to use Access's DatePart function via ODBC, it cannot
Short version: I want to trigger the Form_Load() event without making the form visible.
Short version: I'm wondering if it's possible, and how best, to utilise CPU specific
Short version: assuming I don't want to keep the data for long, how do
Short Version: When I've created a Channel using ChannelFactory on a client which uses

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.