title: Custom ValidationAttribute for multiple data types
body: <p>I have a <code>ValidationAttribute</code> like below which validates that a certain amount of values have been entered on a form. Currently it is only being used on a property with type <code>short?[]</code></p>
  
  <pre><code>public class RequiredArrayLength : ValidationAttribute
      {
          public int TotalRequired { get; set; }
  
          public override bool IsValid(object value)
          {
              if(value != null)
              {
                  var array = value as short?[];
                  return array.Where(v =&gt; v.HasValue).Count() &gt;= TotalRequired;
              }
              return false;
          }
      }
  </code></pre>
  
  <p>Is there a way I can modify this <code>ValidationAttribute</code> so it will work with other numeric arrays such as <code>int?[]</code></p>