In Visual Studio Professional 2010 whenever I type the following:
new {
It automatically changes to:
new object {
Is there a way to make it not do this? "Object" does not have the properties of the object I want to anonymously create.
https://connect.microsoft.com/VisualStudio/feedback/details/584429/autocomplete-on-new-is-interpreted-as-a-new-function-instead-of-anonymous-class
I'm pretty sure it's a bug, so I went ahead and reported it. Was going to do it sooner or later anyway :)
Hope that's okay with you.
You can disable the IntelliSense completing when you type the bracket.
On the Tools menu select Options. Then, on the right hand side, expand Text Editor then C# then IntelliSense. Remove the { from the textbox under the Committed by typing the following characters:
You may also have to uncheck the Committed by pressing the space bar or get in the habit of writing new{
and relying on the auto formatting when you close the bracket (though I've never done any ASPX stuff so don't know how good the auto formatting is compared to a normal code file.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With