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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:46:10+00:00 2026-06-14T17:46:10+00:00

I got this assignment which to declare a method like this… public List<Contact> GetLastContacts([int

  • 0

I got this assignment which to declare a method like this…

public List<Contact> GetLastContacts([int count = 20])  
{  
    return this._entities.ContactsSet.ToList();  
}

What I don’t understand and can’t find info about is [int count = 20] as parameter…

Anyone got an explanation on what they mean?

/Best regards!

  • 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-14T17:46:12+00:00Added an answer on June 14, 2026 at 5:46 pm

    int count = 20 in a parameter declares it as a default value for the parameter. It makes the parameter optional for callers (or rather look optional for callers).

    So, in a method calling it you can do:

    var contacts = GetLastContacts(); // Will compile to GetLastContacts(20)
    

    Or, to use a value to override the default:

    var contacts = GetLastContacts(35); 
    

    See Named and Optional arguments on MSDN.

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

Sidebar

Related Questions

I´ve got this on the parent object @OneToMany(mappedBy=idUser, cascade = CascadeType.MERGE) public List<Directions> directions;
I've got this trivial class hierarchy: class Base { public: virtual int x( )
This is part of a homework assignment. I've got several questions asking find the
So I have this University assignment in which I have to create a trigger
ive got an assignment which requires me to set default language to a win
I have got an assignment in which I have to implement a AS3 wrapper
I have got this assignment question on HMM and I have solved it. I
This is my second week of learning python and I got an homework assignment
I'm trying to complete this assignment, I've got the code set up, however, there's
I have got an assignment in which I should program a simple teller machine

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.