Below you will find pages that utilize the taxonomy term “Linq”
Posts
[C#][Linq]Linq to Wikipedia
private IQueryable<WikipediaKeywordSearchResult>KeyWordSearch(string keyWord) { return from item in (new WikipediaContext()).KeywordSearch where item.Keyword == keyWord select item; }</pre></div>
read morePosts
[C#][Linq]LINQ To WMI
foreach (Win32_UserAccount account in query) { Console.WriteLine(account.Name); } } }
read morePosts
[C#][Linq]BLinq - Linq To Bing
private IEnumerable<ImageSearchResult> SearchImages(string keyWord) { return from item in m_Bing.Images where item.Query == keyWord select item; }</pre>
read morePosts
LINQ to CSV library
Read<T>(string fileName) Read<T>(string fileName, CsvFileDescription fileDescription) Read<T>(StreamReader stream) Read<T>(StreamReader stream, CsvFileDescription fileDescription)
[CsvColumn(Name = "LastName", FieldIndex = 1)] public String LastName { get; set; } [CsvColumn(Name = "Sex", FieldIndex = 2)] public String Sex { get; set; } [CsvColumn(Name = "Birthday", FieldIndex = 3)] public String Birthday { get; set; } public String Memo { get; set; } public override string ToString() { return string.Join(",", new string[] { FirstName, LastName, Sex, Birthday, Memo }); } }</pre> CsvContext cc = new CsvContext(); Person[] persons = new Person[] { new Person() { FirstName = "Larry", LastName = "Nung", Sex = "Boy", Birthday = "1980/04/19" } }; cc.
read morePosts
Linq To Excel Provider
using System.Linq; using System.ComponentModel;
[ExcelSheet(Name=“Sheet1”)] public class Person: INotifyPropertyChanged {
private double _id; private string _firstname; private string _lastname; private DateTime _birthdate; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } [ExcelColumn(Name="ID", Storage="_id")] public double ID { get { return _id;} set { _id = value; SendPropertyChanged("ID"); } } [ExcelColumn(Name="FirstName", Storage="_firstname")] public string FirstName { get { return _firstname;} set { _firstname = value; SendPropertyChanged("FirstName"); } } [ExcelColumn(Name="LastName", Storage="_lastname")] public string LastName { get { return _lastname;} set { _lastname = value; SendPropertyChanged("LastName"); } } [ExcelColumn(Name="BirthDate", Storage="_birthdate")] public DateTime BirthDate { get { return _birthdate;} set { _birthdate = value; SendPropertyChanged("BirthDate"); } } }
read morePosts
Linq To Excel
//自己可自行加要過濾的條件,這邊只是示範 var linq = from item in excel.Worksheet(sheetName) select item; ...</pre> //這邊會取使用Sheet1的工作表內容去做查詢動作 var linq = from item in excel.Worksheet() select item; ...</pre> var linq = from item in excel.Worksheet<Blogger>(sheetName) where item.Sex==SexType.Boy select item; ...</pre> namespace ConsoleApplication1 { class Blogger { public int ID { get; set; } public String FirstName { get; set; } public String LastName { get; set; } public SexType Sex { get; set; } public int Age { get; set; } public String Blog { get; set; }
read morePosts
Linq to GPU (Brahma)
// Create a data-parallel array and fill it with data var data = new DataParallelArray<float>(computationProvider, new[] { 0f, 1f, 2f, 3f, 4f, 5f, 6f }); // Compile the query CompiledQuery query = computationProvider.Compile<DataParallelArray<float>> ( d => from value in d select value * 2f ); // Run the query on this data IQueryable result = computationProvider.Run(query, data); // Print out the results foreach (float value in result) Console.WriteLine(value); // Get rid of all the stuff we created computationProvider.
read morePosts
[Linq]Linq程式逐步執行與偵錯
foreach (var item in linq) { Console.WriteLine(item); } }</pre></div> For Each item In linq Console.WriteLine(item) Next End Sub</pre>
read more