久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

        <bdo id='lRotH'></bdo><ul id='lRotH'></ul>
    1. <i id='lRotH'><tr id='lRotH'><dt id='lRotH'><q id='lRotH'><span id='lRotH'><b id='lRotH'><form id='lRotH'><ins id='lRotH'></ins><ul id='lRotH'></ul><sub id='lRotH'></sub></form><legend id='lRotH'></legend><bdo id='lRotH'><pre id='lRotH'><center id='lRotH'></center></pre></bdo></b><th id='lRotH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='lRotH'><tfoot id='lRotH'></tfoot><dl id='lRotH'><fieldset id='lRotH'></fieldset></dl></div>
      <tfoot id='lRotH'></tfoot>

    2. <small id='lRotH'></small><noframes id='lRotH'>

    3. <legend id='lRotH'><style id='lRotH'><dir id='lRotH'><q id='lRotH'></q></dir></style></legend>

        對象上的Linq SUM?

        Linq SUM on objects?(對象上的Linq SUM?)
        • <small id='WAKq9'></small><noframes id='WAKq9'>

        • <tfoot id='WAKq9'></tfoot>

                <tbody id='WAKq9'></tbody>
              <legend id='WAKq9'><style id='WAKq9'><dir id='WAKq9'><q id='WAKq9'></q></dir></style></legend>
              • <bdo id='WAKq9'></bdo><ul id='WAKq9'></ul>
                <i id='WAKq9'><tr id='WAKq9'><dt id='WAKq9'><q id='WAKq9'><span id='WAKq9'><b id='WAKq9'><form id='WAKq9'><ins id='WAKq9'></ins><ul id='WAKq9'></ul><sub id='WAKq9'></sub></form><legend id='WAKq9'></legend><bdo id='WAKq9'><pre id='WAKq9'><center id='WAKq9'></center></pre></bdo></b><th id='WAKq9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WAKq9'><tfoot id='WAKq9'></tfoot><dl id='WAKq9'><fieldset id='WAKq9'></fieldset></dl></div>

                1. 本文介紹了對象上的Linq SUM?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有一個代表業務數據的對象.

                  I've an object that represent a business data.

                  基本上,它是一個匯總一些總數的對象:

                  Basically, it's an object agregating some totals:

                  public class MyClass{
                     public double MyDataOne {get;set;}
                     public double MyDataTwo {get;set;}
                     public double MyDataThree {get;set;}
                  
                     public static MyClass operator +(MyClass data1, MyClass data2){
                        return new MyClass{MyDataOne = data1.MyDataOne + data2.MyDataOne, MyDataTwo=data1.MyDataTwo+data2.MyDataTwo, MyDataThree=data1.MyDataThree+data2.MyDataThree };
                     }
                  }
                  

                  現在,如果我有一個 IEnumerable<MyClass>myClasses,有什么我可以在 MyClass 中實現的:?

                  Now, if I've an IEnumerable<MyClass> myClasses, Is there somethings I can implement in MyClass to make this:?

                  myClasses.Sum(d=>d);
                  

                  因為對我來說,添加對象的方式必須是對象而不是調用者的知識(如果有一天我多了一個數據,我不想查看我的整個代碼來查看它的位置使用).

                  Because for me, the way an object is additioned must be the knowledge of the object and not the caller(if one day I've one data more, I don't want to look in my whole code to see where it is used).

                  謝謝

                  推薦答案

                  編寫自己的擴展方法:

                  public static MyClass Sum(this IEnumerable<MyClass> source)
                  {
                      var result = new MyClass(); // all data will be zeros
                  
                      foreach(var item in source)
                         result = result + item;
                  
                      return result;
                  }
                  

                  用法:

                  var sum = myClasses.Sum();
                  

                  這篇關于對象上的Linq SUM?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  What are good algorithms for vehicle license plate detection?(車牌檢測有哪些好的算法?)
                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時突出顯示行)
                  Calling A Button OnClick from a function(從函數調用按鈕 OnClick)

                      <legend id='rpRht'><style id='rpRht'><dir id='rpRht'><q id='rpRht'></q></dir></style></legend>
                      <tfoot id='rpRht'></tfoot>

                        <bdo id='rpRht'></bdo><ul id='rpRht'></ul>

                              <tbody id='rpRht'></tbody>
                          1. <i id='rpRht'><tr id='rpRht'><dt id='rpRht'><q id='rpRht'><span id='rpRht'><b id='rpRht'><form id='rpRht'><ins id='rpRht'></ins><ul id='rpRht'></ul><sub id='rpRht'></sub></form><legend id='rpRht'></legend><bdo id='rpRht'><pre id='rpRht'><center id='rpRht'></center></pre></bdo></b><th id='rpRht'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rpRht'><tfoot id='rpRht'></tfoot><dl id='rpRht'><fieldset id='rpRht'></fieldset></dl></div>
                          2. <small id='rpRht'></small><noframes id='rpRht'>

                          3. 主站蜘蛛池模板: 欧美日韩专区 | 欧美一区二区在线观看视频 | 亚洲视频中文 | 亚洲成人三级 | 久久精品av麻豆的观看方式 | 91精品国产手机 | 天堂久久久久久久 | 不卡的av在线 | 国产午夜精品视频 | 欧美日韩在线精品 | 99精品网站 | 欧美精品一区在线发布 | 国产原创在线观看 | 中文字幕在线第一页 | 久久伊人精品 | 国产第一区二区 | 欧美无乱码久久久免费午夜一区 | 国产日韩欧美激情 | caoporn视频在线 | 亚洲国产一区视频 | 亚洲三区在线观看 | zzzwww在线看片免费 | 一级毛片视频在线观看 | 久久99精品久久 | 性高湖久久久久久久久 | 中文字幕国产精品 | 久久久久久久久久久久91 | 中文字幕在线视频免费观看 | 国产精品海角社区在线观看 | 国产视频精品视频 | 国产精品a一区二区三区网址 | 国产午夜精品一区二区三区 | 国精日本亚洲欧州国产中文久久 | 一区二区三区四区五区在线视频 | 国产精品无码专区在线观看 | 逼逼视频 | 国产成人精品一区二区三区四区 | 少妇一级淫片免费放播放 | 国产一区二区三区高清 | av黄色国产 | 精品一二区 |