.net - Extension method for fill rectangular array in C# -


I want the extension method to write to fill the multi-dimensional rectangular array. I know how to do the array with a certain number of measurements:

  fill the public with a static void & lt; T & gt; (This t [source], t value) {for (int i = 0; i  

Can I write a fill method for all multi-dimensional rectangular array?

You can change the fixed dimension parameters in an array parameter so you can add extensions to any array. Then I repeated through each position of the array.

  Fill the public static void & lt; T & gt; (This array source, t-value) {fill (0, source, new tall [source rank, value]); } Fill in constant void & lt; T & gt; (Int dimension, array array, long [] indexed, t value) {var LowerBound = array.GetLowerBound (dimension); Var upper bound = array.getupperbound (dimension); For (int i = low bound; i & lt; = upper bound; i ++) {index [dimension] = I; If (dimension  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -