Skip to content

Note

不挑戰記憶力的技術筆記

Menu
Menu

[ASP.NET MVC][C#]陣列或項目加總使用Zip

Posted on 2020 年 7 月 3 日2021 年 5 月 6 日 by febr

兩個相同長度的陣列內容相加 :

int[] Array1 = new int[] { 1, 2, 3, 4, 5 };
int[] Array2 = new int[] { 6, 7, 8, 9, 10 };
        
int[] ArrayZip = Array1.Zip(Array2, (a, b) => a + b).ToArray();
// zip = [7,9,11,13,15]

兩個相同長度的List內容相加 :

List List1 = new List();
List1.Add(Convert.ToDecimal(1));
List1.Add(Convert.ToDecimal(2));
List1.Add(Convert.ToDecimal(3));

List List2 = new List();
List2.Add(Convert.ToDecimal(4));
List2.Add(Convert.ToDecimal(5));
List2.Add(Convert.ToDecimal(6));

List<decimal> ListZip = List1.Zip(List2, (a, b) => a + b).ToList();
// ListZip = [5,7,9]

近期文章

  • [AWS] S3 Object Initiate restore (復原回 Standard)
  • [Windows] 使用者快速登出的方法 Logout/ Logoff/Sign Out from Windows User Account
  • [Windows] Windows 11 安裝Server管理工具Install RSAT(Remote Server Administrator Tools)
  • Chrome出現:你的連線不是私人連線 Your connection is not private
  • [C#] 取得 Request URL 的方法

近期留言

    彙整

    分類

    • Ajax
    • Android
    • ASP
    • ASP.NET MVC
    • Azure
    • C#
    • Cisco
    • CSS
    • Delphi
    • Developer Tools
    • Framework
    • FreeBSD
    • Git
    • HTML5
    • javascript
    • jQuery
    • Juniper
    • Linux
    • Mac
    • PHP
    • Python
    • Server&OS
    • Software
    • SQL server
    • Sublime Text
    • Ubuntu
    • Visual Studio
    • Vmware
    • Web Design
    • Web Development
    • Windows
    • WordPress
    • 未分類
    • 未分類

    彙整

    分類

    • Ajax
    • Android
    • ASP
    • ASP.NET MVC
    • Azure
    • C#
    • Cisco
    • CSS
    • Delphi
    • Developer Tools
    • Framework
    • FreeBSD
    • Git
    • HTML5
    • javascript
    • jQuery
    • Juniper
    • Linux
    • Mac
    • PHP
    • Python
    • Server&OS
    • Software
    • SQL server
    • Sublime Text
    • Ubuntu
    • Visual Studio
    • Vmware
    • Web Design
    • Web Development
    • Windows
    • WordPress
    • 未分類
    • 未分類

    其他操作

    • 登入
    • 訂閱網站內容的資訊提供
    • 訂閱留言的資訊提供
    • WordPress.org 台灣繁體中文
    © 2025 Note | Powered by Superbs Personal Blog theme