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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:37:38+00:00 2026-06-17T19:37:38+00:00

I recently had a WinRT class definition with methods like this: public void Foo(string

  • 0

I recently had a WinRT class definition with methods like this:

public void Foo(string x){}
public void Foo(CustomClass x){}

The compiler threw an error though that

The 1-parameter overloads of Earlz.FooBar must have exactly one method specified as the default overload by decorating it with Windows.Foundation.Metadata.DefaultOverloadAttribute.

What kind of implications does this attribtue have? I’m unfamiliar with how WinRT projections work, but what I’m writing will eventually be a publicly usable API. So, I want to make sure that I’m not doing something that will cause pain to people who use the API. Should I rename my Foo method to FooCustom or some such, or is using DefaultOverload on the more commonly used function the way to go?

Also, I tried looking up what this attribute does and why it’s required, but MSDN was short on details as usual and just gave single sentence description “Indicates that a method is the default overload method”

I assume the primary reason for this attribute is because Javascript only supports overloading on parameter count, not parameter type. However, how would a Javascript app access the non-default WinRT methods with type overloads?

  • 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-17T19:37:39+00:00Added an answer on June 17, 2026 at 7:37 pm

    As Jesse Jiang described in this thread:

    JavaScript has limited ability to differentiate overloaded methods. Therefore, you need to change the function name, or setting the Windows::Foundation::Metadata::DefaultOverloadAttribute to set the default overload function.

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

Sidebar

Related Questions

I recently had an idea to create my own String class to make using
I recently had a similar thread about this, but now I need to animate
I recently had this problem on a test: given a set of points m
So I recently had a face-palm moment with Javascript and WinRT. Basically, I'm developing
I recently had this issue with a client. The code read: ini_set( sendmail_from, noreply@<current-domain>.com
I recently had an RFI attack where the query string had a bunch of
I recently had to perform some string replacements in .net and found myself developing
I recently had this problem about scrolling and focus changing. I solved it by
I recently had this question in an interview to write test cases to test
I recently had a class project where I had to make a program with

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.