How can i get small and big valuehttp://forums.asp.net/t/1792441.aspx/1?How+can+i+get+small+and+big+valueMon, 16 Apr 2012 04:24:04 -040017924414930479http://forums.asp.net/p/1792441/4930479.aspx/1?How+can+i+get+small+and+big+valueHow can i get small and big value <p>&nbsp;i have a 3-D array like this</p> <pre class="prettyprint">Random objrandom = new Random(); int[, , ] randomNumber = new int[3, 4, 6]; for (int i = 0; i &lt; 3; i&#43;&#43;) { for (int j = 0; j &lt; 4; j&#43;&#43;) { for (int k = 0; k &lt; 6; k&#43;&#43;) { randomNumber[i, j, k] = objrandom.Next(1, 500); } } }</pre> <p></p> <p></p> <p>how can i get small and big value using linq<br> <br> </p> 2012-04-13T06:50:16-04:004930530http://forums.asp.net/p/1792441/4930530.aspx/1?Re+How+can+i+get+small+and+big+valueRe: How can i get small and big value <p>Hi,</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You can try to get min,max as given</p> <pre class="prettyprint">int minVal = randomNumber.Cast&lt;int&gt;().Min(); int maxVal = randomNumber.Cast&lt;int&gt;().Max();</pre> <p></p> 2012-04-13T07:18:49-04:004932768http://forums.asp.net/p/1792441/4932768.aspx/1?Re+How+can+i+get+small+and+big+valueRe: How can i get small and big value <p>Hello binson143</p> <p>Besides LINQAccording to your issue I think an easy way is to use direct comparation and omit the mid numbers to keep both large and small ones</p> <p>Solutions</p> <p>&nbsp; &nbsp;int maxnum;</p> <p>&nbsp; &nbsp;int minnum;</p> <p>&nbsp; &nbsp;maxnum=int.MinValue;</p> <p>&nbsp; &nbsp;minnum=int.MaxValue;</p> <pre class="prettyprint">Random objrandom = new Random(); int[, , ] randomNumber = new int[3, 4, 6]; for (int i = 0; i &lt; 3; i&#43;&#43;) { for (int j = 0; j &lt; 4; j&#43;&#43;) { for (int k = 0; k &lt; 6; k&#43;&#43;) { randomNumber[i, j, k] = objrandom.Next(1, 500); <strong> if(randomNumber[i, j, k]&gt;maxnum) { maxnum = randomNumber[i,j,k]; } else if (randomNumber[i, j, k]&lt;minnum) { minnum = randomNumber[i,j,k]; }</strong> } } }</pre> 2012-04-15T01:46:19-04:004933665http://forums.asp.net/p/1792441/4933665.aspx/1?Re+How+can+i+get+small+and+big+valueRe: How can i get small and big value <p>thanks</p> 2012-04-16T04:24:04-04:00