What ReSharper suggests is clearly overuse of the var keyword. You can use it where the type is obvious:
var obj = new SomeObject();
If the type is not obvious, you should rather write it out:
SomeObject obj = DB.SomeClass.GetObject(42);
More Related Contents:
- Display lines number in Stack Trace for .NET assembly in Release mode
- Can’t view designer when coding a form in C#
- What is the difference between Debug and Release in Visual Studio?
- Handling warning for possible multiple enumeration of IEnumerable
- Access to Modified Closure (2)
- The name ‘ConfigurationManager’ does not exist in the current context
- LINQ: Not Any vs All Don’t
- Combining multiple Attributes to a single Attribute – Merge Attributes
- Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug
- How can I embed an application manifest into an application using VS2008?
- Request.UrlReferrer null?
- Visual Studio displaying errors even if projects build
- Can I set LARGEADDRESSAWARE from within Visual Studio?
- Visual Studio 2013 doesn’t discover unit tests
- Enable SSL in Visual Studio
- No Source available
- Is Int32.ToString() culture-specific?
- How can we change the background color of all other forms from one form?
- How do I generate a constructor from class fields using Visual Studio (and/or ReSharper)?
- Show controls added programmatically in WinForms app in Design view?
- Create web service proxy in Visual Studio from a WSDL file
- Save Settings in VB.Net or C#
- Visual Studio – project shows up as “Miscellaneous Files”
- Symbol file not loading for debugging custom project in Visual Studio 2012
- streamWriter rewrite the file or append to the file
- Get types used inside a C# method body
- How to create an installer for a .net Windows Service using Visual Studio
- Using var outside of a method
- C# tutorial to write gadgets
- Resharper: vars