vb.net - LINQ. Reducing the code by using dynamic queries -


i use following code fill table1 dictionary information found within linq query.

 dim db new databasedatacontext  dim table1 new dictionary(of string, integer)  dim table2 new dictionary(of string, integer)          private function filltable() dictionary(of string, integer)             table1.clear()             dim query = c in db.table1 select new _                                      {.table1id = c.table1id, .table1 = c.table1}             each c in query                 table1.add(c.table1, c.table1id)             next             return table1         end function 

what changes should make function above fill given tablexxx dictionary? see, not use function below fill table2 dictionary.

        private function filltable2() dictionary(of string, integer)             table2.clear()             dim query = c in db.table2 select new _                                      {.table2id = c.table2id, .table2 = c.table2}             each c in query                 table2.add(c.table2, c.table2id)             next             return table2         end function 

what "todictionary()" extension method?

http://msdn.microsoft.com/en-us/library/bb549277.aspx


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -