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 outbalancing our host instance memory usage because we had a lot
I recently began working on a large ASP.NET WebForms project. The project was using
I recently began using github and started playing with eclipse's git abilities, using some
I have recently began using C# to invoke powershell scripts, with some success :)
I've recently began using C++ with XCode and I'm starting to miss the integrated
I've recently switched my app over to Rails 3.1 and began using the asset
I recently switched from using screen to tmux (obtained through macports), as I like
I recently began setting up my own library and projects using a cross platform
I recently start playing with stored procedures for db2(one day ago) and I manage
I've been using Allegro 5 for a while now, and recently began looking into

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.