新聞中心
學(xué)習(xí)LINQ時(shí),經(jīng)常會(huì)遇到LINQ泛型數(shù)據(jù)集問題,這里將介紹LINQ泛型數(shù)據(jù)集問題的解決方法。

膠州網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營(yíng)維護(hù)。創(chuàng)新互聯(lián)建站于2013年開始到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來(lái)保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。
查詢是一種從數(shù)據(jù)源檢索數(shù)據(jù)的表達(dá)式。查詢用專用查詢語(yǔ)言表示。隨著時(shí)間的推移,人們已經(jīng)為不同類型的數(shù)據(jù)源開發(fā)了不同的語(yǔ)言,例如,用于關(guān)系數(shù)據(jù)庫(kù)的 SQL 和用于 XML 的 XQuery。這使應(yīng)用程序開發(fā)人員必須針對(duì)所支持的每種數(shù)據(jù)源或數(shù)據(jù)格式而學(xué)習(xí)新的查詢語(yǔ)言。
語(yǔ)言集成查詢 (LINQ) 通過提供一種跨各種數(shù)據(jù)源和數(shù)據(jù)格式使用數(shù)據(jù)的一致模型,簡(jiǎn)化了這一情況。在 LINQ 查詢中,始終會(huì)用到對(duì)象。在查詢和轉(zhuǎn)換 XML 文檔、SQL 數(shù)據(jù)庫(kù)、ADO.NET 數(shù)據(jù)集和實(shí)體、.NET Framework 集合中的數(shù)據(jù)以及具有相應(yīng)的 LINQ 提供程序的任何其他源或格式的數(shù)據(jù)時(shí),都會(huì)使用相同的基本編碼模式。
定義一個(gè)返回LINQ泛型數(shù)據(jù)集代碼:
- using System;
- using System.Collections.Generic;
- namespace BlueCube.BusinessLogic
- {
- ///
- /// Encapsulates execution result contains whether the
execution is successful and what messages the invoker will receive.- ///
- public class ExecutionResult
- {
- ///
- /// True as execution is successful. False as failed.
- ///
- public bool Success
- {
- get;
- set;
- }
- private List
_Messages = null; - ///
- /// Stores message list
- ///
- public List
Messages - {
- get
- {
- // Initialize message list if it is null
- if (_Messages == null)
- {
- _Messages = new List
(); - }
- return _Messages;
- }
- set
- {
- // Clear existed message list then add new list from value
- if (_Messages != null)
- {
- _Messages.Clear();
- foreach (string message in value)
- {
- _Messages.Add(message);
- }
- }
- else
- {
- _Messages = value;
- }
- }
- }
- ///
- /// Encapsulates the value if there is any return value during execution
- ///
- public T ReturnValue
- {
- get;
- set;
- }
- }
- }
以上介紹定義一個(gè)返回LINQ泛型數(shù)據(jù)集。
本文標(biāo)題:LINQ泛型數(shù)據(jù)集淺談
網(wǎng)頁(yè)網(wǎng)址:http://www.5511xx.com/article/cddpcso.html


咨詢
建站咨詢
