'ary1.Length を優先する Function AddElements2(ByVal ary1() As Double, ByVal ary2() As Double) As Double() Return ary1.Select(Function(e, i) e + ary2.ElementAtOrDefault(i)).ToArray() End Function '要素数が異なる場合、不足している方は 0.0 として扱う Function AddElements3(ByVal ary1() As Double, ByVal ary2() As Double) As Double() Return (From i In Enumerable.Range(0, Math.Max(ary1.Length, ary2.Length)) _ Select ary1.ElementAtOrDefault(i) + ary2.ElementAtOrDefault(i)).ToArray() End Function