CSharp examples for System:Array Element
Check if the number of items in the array is between the two expected numbers.
using System.Globalization; using System.Collections.Generic; using System.Collections; using System;/*from w ww .ja v a2s .com*/ public class Main{ /// <summary> /// Check if the number of items in the array is between the two expected numbers. /// </summary> /// <param name="array"></param> /// <param name="rangeStart"></param> /// <param name="rangeStop"></param> /// <returns></returns> public static bool IsRankInRange (Array array, int rangeStart, int rangeStop) { if (array == null) return false; return IsInRange (array.Rank, rangeStart, rangeStop); } /// <summary> /// Check if the number of items in the array is less then or equal to the expected number. /// </summary> /// <param name="array"></param> /// <param name="maxRange"></param> /// <returns></returns> public static bool IsRankInRange (Array array, int maxRange) { if (array == null) return false; return IsInRange (array.Rank, 0, maxRange); } }