Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReSharper auto-complete behavior with anonymous types in a lambda expression

I am using C# 3.5 and Linq. I have ReSharper 6.1 on VS 2010.

For example, if I enter the following statement in the code editor:

var result = dataContext.Items.Select(i => new {Name = i.ItemName});

As soon as I type the new { it auto-completes to new string{}. Actually, not sure if it is always string or depends on the lambda. But I find I always need to delete it and back up. This happens whenever I am declaring anonymous types in a lambda.

What setting in ReSharper or VS do I need to change in order to be able to enter anonymous types using the above syntax without that occurring? Preferably, I would like to retain auto-completing in all other situations, just not this particular one as it is making an incorrect assumption as to my intent.

like image 944
Jon Comtois Avatar asked Feb 28 '12 19:02

Jon Comtois


1 Answers

Resharper 6.1 added a new feature to control the way the intellisense autopopups act. Go to ReSharper->Options->Environment->IntelliSense->Autopopup and change the "After 'new'" setting to "Display but do not preselect".

enter image description here

like image 160
Piers Myers Avatar answered Oct 20 '22 15:10

Piers Myers