Skip to content

Commit 6cd07da

Browse files
committed
edits
1 parent 3f89b78 commit 6cd07da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/profiling/optimize-code-using-profiling-tools.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ foreach (var blog in db.Blogs.Select(b => new { b.Url, b.Posts }).ToList())
137137

138138
This code uses `foreach` loops to search the database for any blogs with "Fred Smith" as the author. Looking at it, you can see that a lot of objects are getting generated in memory: a new object array for each blog in the database, associated strings for each URL, and values for properties contained in the posts, such as blog ID.
139139

140-
We do a little research and find some common recommendations for how to optimize LINQ queries and come up with this code. Alternatively, we can save time and let [Copilot](../ide/visual-studio-github-copilot-extension.md) do the research for us.
140+
We do a little research and find some common recommendations for how to optimize LINQ queries. Alternatively, we can save time and let [Copilot](../ide/visual-studio-github-copilot-extension.md) do the research for us.
141141

142-
If we're using Copilot, we can ask Copilot to research performance issues for us. We select **Ask Copilot** from the context menu and type the following question:
142+
If we're using Copilot, we select **Ask Copilot** from the context menu and type the following question:
143143

144144
```cmd
145145
Can you make the LINQ query in this method faster?
@@ -165,7 +165,7 @@ public void GetBlogTitleX()
165165
}
166166
```
167167

168-
In this code, we made several changes to help optimize the query:
168+
This code includes several changes to help optimize the query:
169169

170170
- Added the `Where` clause and eliminated one of the `foreach` loops.
171171
- Projected only the Title property in the `Select` statement, which is all we need in this example.

0 commit comments

Comments
 (0)