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

The Archive Base Latest Questions

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

These types of methods have always bothered me. Without digging through the code, I

  • 0

These types of methods have always bothered me. Without digging through the code, I have no idea what the key or sub-value is supposed to be in this dictionary. I’ve done this myself about a thousand times, I’m sure. But it has always bothered me because it lacks so much information.

IDictionary<int,HashSet<int>> GetExportedCharges()
{
    ...
}

void GetVisitStatuses(IDictionary<int,HashSet<int>> exportedCharges)
{
    ...
}

Having the material in a dictionary makes sense, but all of the IDictionary methods have very abstract parameters. I suppose I could create a new class, implement IDictionary, and rename all of the parameters. It just seems like overkill. Makes be wish c# had a ‘typdef’ directive.

How do you avoid returning dictionaries like this? Or do you avoid this at all?

  • 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-23T07:35:32+00:00Added an answer on May 23, 2026 at 7:35 am

    There is a very simple solution that you might find adequate:

    public class IdToSetOfWidgetNumbersMap : Dictionary<int,HashSet<int>> { }
    

    Advantages:

    • Seeing a method returning an IdToSetOfWidgetNumbersMap doesn’t leave many questions open
    • The class can be left totally empty, or you can choose to provide aliases for the members exposed by Dictionary if you prefer

    Disadvantage:

    • You need to create a do-nothing class for each type of dictionary
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have always understood there to be two types of equality in Java, value
My DataGridView needs to support a number of types and these types may have
I have the types Rock , Paper , and Scissors . These are components,
I have some logic, which defines and uses some user-defined types, like these: class
I'm always referencing DLLs in my C# code, but they have remained somewhat of
I'm trying to find the correct names for these 2 types of coding expressions
I have to add a coupon table to my db. There are 3 types
Scenario I have a line of code whereby I pass a good number of
The Scala compiler can often infer return types for methods, but there are some
I frequently have to deal with DataTables connected to grid controls, custom updating always

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.