- 
                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
Conversation
| 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: | 
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.
| [!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: | 
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.
Please rephrase the sentence, it doesn't look grammatically correct now.
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.
I'd rephrase as "and similar types. The new syntax supports assignment using an index into the collection."
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.
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.
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.
Thanks for submitting this change @DevonAleshire We appreciate it.
I've looked at the changes, and I have a suggestion to one of the comments by @pkulikov.
If you can make an update to the same branch to update PR, I'll merge it.
Thanks again for your contribution.
| These changes were incorporated by @DevonAleshire into PR #5577 Closing | 
* Update csharp-6 Modified Index Initializer verbiage to identify collection initializers were able to be used with Dictionaries previously. Tried to identify that the change makes use of the indexer versus calling the add method by remaining more consistent with index usage. Might want to update example or links to the Dictionary collection initializer page within docs. * Index Initializer #5506 Update typo and verbiage in accordance with reviewed comments.
Summary
Minor updates to Index initializer verbiage adding that Dictionary is still able to be initialized using collection initializer and focusing change on the fact that we are now using indexer allowing users to be more consistent with its actual usage/assignment.
Fixes #Issue_Number 5169