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

The Archive Base Latest Questions

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

I recently began to start using functions to make casting easier on my fingers

  • 0

I recently began to start using functions to make casting easier on my fingers for one instance I had something like this

((Dictionary<string,string>)value).Add(foo);

and converted it to a tiny little helper function so I can do this

ToDictionary(value).Add(foo);

Is this against the coding standards?

Also, what about simpler examples? For example in my scripting engine I’ve considered making things like this

((StringVariable)arg).Value="foo";

be

ToStringVar(arg).Value="foo";

I really just dislike how inorder to cast a value and instantly get a property from it you must enclose it in double parentheses. I have a feeling the last one is much worse than the first one though

  • 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-14T22:07:36+00:00Added an answer on May 14, 2026 at 10:07 pm

    Ignoring for a moment that you may actually need to do this casting – which I personally doubt – if you really just want to “save your fingers”, you can use a using statement to shorten the name of your generic types.

    At the top of your file, with all the other usings:

    using ShorterType = Dictionary<string, Dictionary<int, List<Dictionary<OtherType, ThisIsRidiculous>>>>;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently began using BIRT and have developed a report to use with my
I recently began profiling an osgi java application that I am writing using VisualVM.
I've recently began using dTrace and have noticed just how awesome it is. Its
Recently I've been doing lots of weekend coding, and have began to really need
Good morning! Recently I bought an Arduino board to make sort of light control
I recently began importing a number of our projects into a Subversion repository at
I recently began exploring Scapy. A wonderful tool indeed! I have a problem... When
I've recently began on working on my first CORBA project. I think I got
I just recently began in C# development, and I was working on a forms-based
I've recently begun evaluating a few project management projects for the company I work

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.