public static void ValidaMasked(string masked, TipoMasked tipo) { //string mensagem = "OK"; switch (tipo) { case TipoMasked.cep: if (masked.Length < 8) { throw new Exceptions.Validacoes.MaskedInvalidaException(tipo); } break; case TipoMasked.ddi: if (masked.Length < 2) { throw new Exceptions.Validacoes.MaskedInvalidaException(tipo); } break; case TipoMasked.ddd: if (masked.Length < 2) { throw new Exceptions.Validacoes.MaskedInvalidaException(tipo); } break; case TipoMasked.tel: if (masked.Length < 8) { throw new Exceptions.Validacoes.MaskedInvalidaException(tipo); } break; case TipoMasked.cpf: if (masked.Length < 11) { throw new Exceptions.Validacoes.MaskedInvalidaException(tipo); } break; case TipoMasked.cnpj: if (masked.Length < 14) { throw new Exceptions.Validacoes.MaskedInvalidaException(tipo); } break; case TipoMasked.data: if (masked.Length < 6) { throw new Exceptions.Validacoes.MaskedInvalidaException(tipo); } break; } }