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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:36:50+00:00 2026-06-03T08:36:50+00:00

Can I setup a Dictionary of MyDict<Type, BlockingCollection<differentTypes> possibly through an interface that circumvents

  • 0

Can I setup a Dictionary of MyDict<Type, BlockingCollection<"differentTypes"> possibly through an interface that circumvents any casting thus preventing the usage of object or dynamic types?

The reason I want to use such is because I want to initialize Blocking Collections of different types at runtime because incoming objects are of different types and I then want to add such incoming objects to the type matching Blocking Collection. I also want to access the objects within the BlockingCollection later on without having to cast. The necessary types of the Blocking collection are known at the instantiating time of the wrapping class. The types of the incoming object are known at runtime only. Incoming object types will never be different from the types known at the class instantiation time. The types of the objects that I want to retrieve from the matching BlockingCollection are also only known at runtime. Any way to set this up without having to cast?

I browsed through many related questions but did not find the exact same specs described here.

  • 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-03T08:36:52+00:00Added an answer on June 3, 2026 at 8:36 am

    Ultimately, “differentTypes” means either object, or a common base-class / interface. If those types are value-types, then they will have to be boxed and unboxed (although you indicate that these are class objects so this doesn’t apply – only structs are ever boxed/unboxed). So that leaves a few casts – casts are pretty stonkingly fast: I wouldn’t be too concerned about the impact of that.

    Of course, if there is some commonality between the “differentTypes” (some common interface etc), then you might be able to use that common interface without ever casting.

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

Sidebar

Related Questions

Is there any way I can setup my test data for load tests that
I can setup a connection manager that uses the Directory Services OLE provider and
Can I setup Team Foundation Server in such a manner that every uer have
I have an application that takes a dictionary of files (file type, and list
I am trying to pass messages between several classes that communicate through interface. However,
I'm trying to follow the instructions here ( http://docs.pylonsproject.org/projects/pyramid_beaker/en/latest/ ) so I can setup
Can you setup a variable for javascript in one page and have another page
How can I setup expires headers in PHP + Apache? I'm currently using an
How can I setup custom sorting method for a QTableView , or for the
If a UILabel contains too much text, how can I setup my label so

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.