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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:42:53+00:00 2026-05-25T13:42:53+00:00

After typing the following into Visual Studio 2010, using(var myEntities = new MyEntities()) {

  • 0

After typing the following into Visual Studio 2010,

using(var myEntities = new MyEntities())
{
    IQueryable<Employee> employees =
        from    e in myEntities.Employees
        where   e.Name == name &&
                e.Password == hasher.ComputeHash(password)
        select  e;

    ...  Code left out for simplicity ...

I encounter a formatting problem when I enter the closing brace. Specifically, the text editor reformats the spaces in my linq query so that I end up with,

using(var myEntities = new MyEntities())
{
    IQueryable<Employee> employees =
        from e in myEntities.Employees
        where e.Name == name &&
                e.Password == hasher.ComputeHash(password)
        select e;

    ...  Code left out for simplicity ...
}

Is it possible to change something in the formattings settings for Visual Studio to prevent the spaces in my linq query from being automatically deleted? I’ve tried Googling this, and I’ve looked through the Tools -> Options window of Visual Studio but wasn’t able to find anything. Hopefully, I just overlooked something…

Many thanks in advance!

  • 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-25T13:42:53+00:00Added an answer on May 25, 2026 at 1:42 pm

    In VS, go to Tools->Options, then Text Editor->C#->Formatting->General. Uncheck at least the first two checkboxes on this page. That will prevent VS from automatically formatting your code. However, there is no way to disable autoformat only for LINQ queries.

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

Sidebar

Related Questions

When creating a new message using Mail on the iPhone, and after typing the
Using SQLDeveloper 2.1.1.64, if you try typing the following code: DECLARE v_status_code NUMBER; v_status_text
recently I treid to add Allegro5 library to Visual Studio 2010. I visited allegro.cc
After reading the Head First Design Patterns book and using a number of other
I'm seeing a strange build bug a lot. Sometimes after typing some code we
when using a makefile, I want the following to be possible: make clean make
I have executed the following create statement using SQLWorkbench at my target postgresql database:
I have a script which displays search results after typing something in the input
I'm having troubles logging in to PhpMyAdmin. When I press login after typing in
I am using ASP.NET MVC 3. I have an action method called New. When

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.