Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Please add example #2506

Copy link
Copy link
Open
Open
Copy link
@CeciAc

Description

@CeciAc
Issue body actions

@x13xxxswatxxx commented on Sat May 18 2019

public static System.Collections.Generic.Comparer<T> Create (Comparison<T> comparison);


Сведения о документе

Не вносите правки в этот раздел. Это необходимо для связывания страницы сайта docs.microsoft.com с вопросом на GitHub.

  • ID: 7407922f-6c5b-f488-87ab-3568bc8b872c
  • Version Independent ID: 9b175d8d-9060-a305-1a21-bce8eaa891be
  • Content: Comparer<T>.Create(Comparison<T>) Method (System.Collections.Generic)
  • Content Source: [xml/System.Collections.Generic/Comparer1.xml](https://github.com/dotnet/dotnet-api-docs.ru-ru/blob/live/xml/System.Collections.Generic/Comparer1.xml)
  • Product: dotnet-api
  • Technology: system.collections
  • GitHub Login: @dotnet-bot
  • Microsoft Alias: dotnetcontent

@CeciAc commented on Tue May 21 2019

Hello, @x13xxxswatxxx
 
We truly appreciate your comment and we strive to improve your experience in docs.microsoft.com. However, we need more information in order to be able to address your feedback. Can you please provide more detailed information and clarify your comment?
 
Kind regards,
Microsoft DOCS International Team


@x13xxxswatxxx commented on Wed May 22 2019

https://docs.microsoft.com/ru-ru/dotnet/api/system.collections.generic.dictionary-2.keycollection?view=netframework-4.8
Extension Methods in rus version
Append(IEnumerable, TSource) - Добавляет значение в конец последовательности. (Adds a value to the end of the sequence.)
My example: don't Adds a value to the end of the sequence
Dictionary<int, string> _HTTPError = new Dictionary<int, string>()
{
[400] = "Bad Request",
[401] = "Unauthorized"
}

_HTTPError.Append(new KeyValuePair<int, string>(2000, "Fail line!"));
Console.WriteLine(_HTTPError[2000]);
System.Collections.Generic.KeyNotFoundException: "The given key '2000' was not present in the dictionary."
 
Append method returns a new sequence
Dictionary<int, string> _HTTPError = new Dictionary<int, string>()
{
[400] = "Bad Request",
[401] = "Unauthorized"
}

var _new = _HTTPError.Append(new KeyValuePair<int, string>(2000, "Fail line!"));
Console.WriteLine(_new[2000]);
It work


@MSDN-WhiteKnight commented on Wed May 22 2019

Append method is not a part of Dictionary class, it's an extension method of IEnumerable. This aspect is covered in detail in its article: https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.append?view=netframework-4.8#remarks

Note

This method does not modify the elements of the collection. Instead, it creates a copy of the collection with the new element.

I don't think any changes should be made to Dictionary article. But it might be useful to reword Append method summary a little. Such as Returns a new sequence, produced by appending a value to the end of the source sequence.


@x13xxxswatxxx commented on Wed May 22 2019

I'm talking about this. On this page, in the English version, there is no this method, but there is a Russian one. What is misleading. You can also get confused in any of the links Microsoft Docs. They intersect with each other, from easy to complex, in different languages. One word trash.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.