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

The Archive Base Latest Questions

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

The C# documentation recommends the using directive to bring types into local scope. Indeed,

  • 0

The C# documentation recommends the using directive to bring types into local scope. Indeed, I can do something like:

using DD = IDictionary<string,IDictionary<string,Blah>>;

and it works fine. However, I would like to be able to do:

using DD<Blah> = IDictionary<string,IDictionary<string,Blah>>

But the compiler dies at:

using DD<Blah...
        ^ ; expected

Is there a way to express such a type synonym, instead of repeating horrendously long generic names all over the place ?

Context

I wanted to know if it was possible to write a generic, recursive wrapper on the output type of read-only collection. With the following interface

interface IIndexable<in In, out Out> { Out this[In idx] { get; }}

I managed to write

IIndexable<Key,VOut> map(IIndexable<Key,VIn> coll, Func<VIn, VOut> f)

I guess I’m really trying to emulate the convenience of Haskell’s Functor typeclass.

So, wrapping my complex type in a custom class will not cut it, as it is being assembled from a stack of map()s and there is no single new call to replace with a custom wrapper class.

  • 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-23T22:35:45+00:00Added an answer on May 23, 2026 at 10:35 pm

    Sadly, no. You’d have to define an alias for each Blah type (in your example).

    Like:

    using DB = IDictionary<string,IDictionary<string,Blah>>;
    using DG = IDictionary<string,IDictionary<string,Gah>>;
    

    I know, kinda frustrating.

    (However, I would encourage you to consider whether you really want code that’s dealing with variables typed as IDictionary<string, IDictionary<string, Blah>> in the first place. When you’re nesting data structures like that, it’s a good time to ask yourself whether you should be encapsulating some of that in a custom class that actually makes it easy to do what you want without giving yourself a headache. Of course, it may be that you’re asking this question specifically because you’re writing such a class, in which case, carry on.)

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

Sidebar

Related Questions

PostgreSQL documentation recommends using a CallableStatement to call stored procedures. In the case of
Documentation can be found here It says in the example: onDrop: Called whenever a
Apples documentation recommends to use pngs when loading images. But if you have a
When using Erlang programs like ejabberd the Erlang port mapper daemon epmd is started
I'd like to extract the text from an HTML file using Python. I want
This is from the django documentation : condition(etag_func=None, last_modified_func=None) etag(etag_func) last_modified(last_modified_func) These decorators can
I was reading in google's documentation their new pagespeed plugin, that they recommend using
I'm using the xmpppy library to write an XMPP client that can chat with
I'd like to extract the text from an HTML file using Python. I want
Based on documentation and articles it is recommended to call Abort() on a client

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.