title: How to transform the list to dictionary in C# using linq?
body: <p>I have data like below</p>
  <pre><code>        var listOfForm= new List&lt;FormType&gt;()
          {
                  new FormType() {  Page = 1, Type = &quot;FORM-K4&quot;},
                  new FormType() {  Page = 2, Type = &quot;OTHER-FORM&quot;},
                  new FormType() {  Page = 3, Type = &quot;OTHER-FORM&quot;},
                  new FormType() {  Page = 4, Type = &quot;FORM-K5&quot;},
                  new FormType() {  Page = 5, Type = &quot;OTHER-FORM&quot;},
                  new FormType() {  Page = 6, Type = &quot;OTHER-FORM&quot;},
                  new FormType() {  Page = 7, Type = &quot;OTHER-FORM&quot;},
                  new FormType() {  Page = 8, Type = &quot;FORM-K6&quot;},
                  new FormType() {  Page = 9, Type = &quot;OTHER_FORM&quot;},
                  new FormType() {  Page = 10, Type = &quot;FORM-K7&quot;},
                  new FormType() {  Page = 11, Type = &quot;FORM-K7&quot;},
                  new FormType() {  Page = 12, Type = &quot;OTHER_FORM&quot;},
          };
  </code></pre>
  <p>I want to create a dictionary. I want to add these two OTHER-FORM after FORM-K4 to the dictionary where the key is FORM-K4 and the rest of the list got the same pattern, added the OTHER-FORM to the type/key that was detected before.</p>
  <p>for example, there are three Other-form after form-k5, so I want add each Page form these other-form to form-k5 key.</p>
  <pre><code>var dictForm = dictionary&lt;Type, List&lt;Page&gt;&gt;
  </code></pre>
  <p>so when I access dictForm.key form-k5 it will return value 4,5,6,7 and when the key is form-k4 value is 1,2,3.</p>