2012-11-09 用linq將list的資料轉成string[] 3990 0 Asp.net 用linq將list的資料轉成string[] 因為之前用習慣泛型 to datatble,datatable轉泛型 突然需要把IEnumerable<string>的ToArray<string>()忘了要怎麼寫? 還好有google大神,原來還蠻簡單的,範例如下 string[] emaillist = (from x in mb select x.email).ToArray() ; 這樣就搞定了,寫起來,以免以後又要再找一次 &amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;lt;a data-cke-saved-href=&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot;http://www.facebook.com/sharer.php&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot; href=&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot;http://www.facebook.com/sharer.php&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot; type=&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot;button_count&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot; data-cke-saved-name=&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot;fb_share&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot; name=&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot;fb_share&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;quot;&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;gt;分享&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;lt;/a&amp;amp;amp;ampamp;amp;amp;amp;amp;amp;amp;amp;gt; Asp.netc#Linq 回首頁