{"id":3542,"date":"2014-03-27T07:56:38","date_gmt":"2014-03-27T07:56:38","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/27\/problem-about-linq-to-dataset-collection-of-common-programming-errors\/"},"modified":"2014-03-27T07:56:38","modified_gmt":"2014-03-27T07:56:38","slug":"problem-about-linq-to-dataset-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/27\/problem-about-linq-to-dataset-collection-of-common-programming-errors\/","title":{"rendered":"problem about linq-to-dataset-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/bLX0T.png?s=32&amp;g=1\" \/><br \/>\n13 revsTim Schmelter<br \/>\n.net vb.net linq compiler linq-to-dataset<br \/>\nEdit: Here is a much more simpler example of this issue (i&#8217;ve deleted my original question):Dim numbers1 As New List(Of Int32)({1, 2, 3}) Dim numbers2 As New List(Of Int32)({3, 4, 5}) For Each n1 In numbers1&#8242; no warning &#8216;Dim contains = numbers2.Contains(n1) Next For Each n1 In numbers1&#8217; warning on n1&#8217;Dim contains = (From num In numbers2 Where num = n1).Any NextSo i still don&#8217;t understand why the compiler thinks that i may get unexpected results in the second iteration whereas i&#8217;m safe with the f<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/52d8d1714c9b0fa45895b79852e1ad25?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nO.O<br \/>\nc# generics linq-to-dataset<br \/>\nI have a method that determines the min and max of a column in a DataTable:public void GetMinMaxRange( DataTable data, string valueColumnName ) {var min = data.AsEnumerable().Min(m =&gt; m.Field&lt;double&gt;(valueColumnName));var max = data.AsEnumerable().Max(m =&gt; m.Field&lt;double&gt;(valueColumnName)); }I want to refactor this to be:public void GetMinMaxRange( DataTable data, string valueColumnName ) {DataColumn column = data.Columns[valueColumnName];var min = data.AsEnumerable().Min(m =&amp;g<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/39a090e48ae3a94fe025a73573ead91f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njulien<br \/>\nc# linq dataset strongly-typed-dataset linq-to-dataset<br \/>\nHere is the configuration of my datatables that I use in my linq query: I have 2 dataset files (all the columns of all the tables have a DataType specified and their AllowDbNull property set to True): * deposit_position_imbalance.xsd:Contains 2 datables : &#8211; Imbalance- ImbalanceDetailForRealTime * dep_pos_imbalance_detail.xsd:Contains 1 datatable : &#8211; TableIn the code below, the problem lies in the 2 lines &#8220;deal_date = b.deal_date&#8221;. Indeed, when I retrieve from the database b.deal_date that has a<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/770eb708789729b6ccbae9e2973e9996?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJay Stevens<br \/>\nc# datetime linq-to-dataset<br \/>\nI need to get the minimum DateTime value of a column in a DataTable. The DataTable is generated dynamically from a CSV file, therefore I don&#8217;t know the name of that column until runtime. Here is code I&#8217;ve got that doesn&#8217;t work&#8230;private DateTime GetStartDateFromCSV(string inputFile, string date_attr) {EnumerableRowCollection&lt;DataRow&gt; table = CsvStreamReader.GetDataTableFromCSV(inputFile, &#8220;input&#8221;, true).AsEnumerable();DateTime dt = table.Select(record =&gt; record.Field&lt;DateTime&gt;(dat<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>13 revsTim Schmelter .net vb.net linq compiler linq-to-dataset Edit: Here is a much more simpler example of this issue (i&#8217;ve deleted my original question):Dim numbers1 As New List(Of Int32)({1, 2, 3}) Dim numbers2 As New List(Of Int32)({3, 4, 5}) For Each n1 In numbers1&#8242; no warning &#8216;Dim contains = numbers2.Contains(n1) Next For Each n1 In [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3542","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3542"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3542\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}