I think this question can partly mimic other similar questions, but I have trouble with such a situation
For example,
I want to create an IEnumerable word; Then, both codes and I am doing this way: And here's the problem: I have included a The solution given above all cures, but this requires me the other way. I The result that I want is in the form of an image: Any suggestions and advice Thank you. You can: But for the case, why not use it?
var separators = new [] {',', '', '.'}; IEnumerable & LT; String & gt; Word = sentence Sample (Separator, String Split Option. RemoveEmptyEntries); After that, press all these words and take the characters of the characters in a different ascending sorted collection.
var firstchurch = word Selection (x = & gt; x.ToCharArray (). First ()). Serial (x = & gt; x). Undoubtedly (); words for all characters in the items by words Get it. In which the first letter is equal to current character and a dictionary & lt; Char, IEnumerable & lt; String & gt; & Gt; Dictionary .
var dictionary = (words from k in the first words where v.ToCharArray (). () .Equals ( K) Select new {k, v}). ToDictionary (x => x); An item with the same key has already been added. Whis because it is adding an existing character to that dictionary GroupBy extension in my query
var Dictionary = (In the first words from k to words in v.ToCharArray () first (). Select equals (k) new {k, v}) .GroupBy (x => x). ToDictionary (x => x);
What should I do to get the result < but not dictionary & Lt; IGouping & lt; One, 'A & gt; & Gt; dictionary dictionary & lt; Char, IEnumerable & lt; String & gt; & Gt;
But here I have to be repeated with two foreach (s) which will show me the watt which I want ... I can not understand how this happens ...
var word = .. . Var dictionary = words.GroupBy (w = & gt; w [0]). ToDictionary (g = & gt; g.Key, g = & gt; g.AsEnumerable ());
var lookup = words.ToLookup (w = & gt; w [0]);
No comments:
Post a Comment