-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Index Initializer #5506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Index Initializer #5506
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -508,12 +508,12 @@ if any, is lost. | |
| ## Index Initializers | ||
|
|
||
| *Index Initializers* is one of two features that make collection | ||
| initializers more consistent. In earlier releases of C#, you could use | ||
| *collection initializers* only with sequence style collections: | ||
| initializers more consistent with index usage. In earlier releases of C#, you could use | ||
| *collection initializers* only with sequence style collections, including <xref:System.Collections.Generic.Dictionary%602> with braces around Key-Vlue pairs: | ||
|
|
||
| [!code-csharp[ListInitializer](../../../samples/snippets/csharp/new-in-6/initializers.cs#ListInitializer)] | ||
|
|
||
| Now, you can also use them with <xref:System.Collections.Generic.Dictionary%602> collections and similar types: | ||
| Now, you can use them with <xref:System.Collections.Generic.Dictionary%602> collections and similar types more consistent regular index usage and assignment: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rephrase the sentence, it doesn't look grammatically correct now.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rephrase as "and similar types. The new syntax supports assignment using an index into the collection."
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated and submitted with the changes. Sorry for the previous issues and look forward to learning more and assisting in a greater capacity with the documentation in the future! Thanks for the help. Let me know if there are any remaining changes to be made. |
||
|
|
||
| [!code-csharp[DictionaryInitializer](../../../samples/snippets/csharp/new-in-6/initializers.cs#DictionaryInitializer)] | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo and what about rephrasing: ...around Key-Vlue pairs -> ...around key and value pairs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pkulikov My sincere apologies. I did not mean for that to happen. I was sick that day so stayed home and was looking at what opportunities were available. Will update accordingly, and thank you for your recommendation. Greatly appreciated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DevonAleshire thank you very much for updating the text.