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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:17:04+00:00 2026-05-10T21:17:04+00:00

Our coding standards ask that we minimise the use of C# var (suggests limiting

  • 0

Our coding standards ask that we minimise the use of C# var (suggests limiting it’s use to being in conjunction with Linq). However there are times when using generics where it’s reasonably convenient e.g.

Dictionary<DateTime, Dictionary<string, float>> allValues = ... // ... foreach (var dateEntry in allValue) 

is easier to type

foreach (KeyValue<DateTime, Dictionary<string, float>> dateEntry in allValue)  

(and easier than remembering what the explicit type is in some cases).

Do any of the refactoring tools have the ability to convert the former to the latter. I’ve had a look at Resharper but it doesn’t seem to do (indeed it’s default suggestion is to go in the opposite direction).

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-10T21:17:04+00:00Added an answer on May 10, 2026 at 9:17 pm

    I’ve got ReSharper 4.1, and it does offer this option (in either direction).

    Actually, I’d recommend challenging the standard… the former is far more readable than the latter (especially if you call the variable pair or something similar). I would’t use ‘var’ for var i = 0, but it is ideally suited to the above.

    For bulk changing, go to:

    • Cleanup Code… (pick a profile => ‘Edit Profiles’ => Tools => Code Cleanup)
      • C#
        • Use ‘var’ in declaration
          • Replace direction = Can ‘var’ to type usage
          • ‘foreach’ iterator declaration style = Always use explicit type
          • Local variable declaration style = Always use explicit type

    and run…

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

Sidebar

Related Questions

I'm about to undertake updating our coding standards documentation and I am thinking of
What Delphi coding standards document(s) do you follow? Our company is looking at putting
We implemented new coding standards, which call for our private members to have a
We all know that commenting our code is an important part of coding style
For whatever reason, our company has a coding guideline that states: Each class shall
I want some questions to be answered by our fellow developers regaurding coding standards.
There is a table in our database that acts very much like a standard
We're about to look at implementing some PHP Coding Standards in our workplace to
Our coding standards have us putting each attribute within a tag on a separate
I am in the process of writing (down) our companies coding standards for Delphi

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.