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?
Comments
Post a Comment