codice:
        public bool ValidPartitaIva(this string paramPI)
        {
            int pari = 0;
            int dispari = 0;

            for (int i = 1; i < 11; i++)
            {
                if (i % 2 != 0) dispari += (int)Char.GetNumericValue(paramPI[i - 1]);
                else
                {
                    var temp = (int)Char.GetNumericValue(paramPI[i - 1]) * 2;
                    if (temp > 9) temp -= 9;
                    pari += temp;
                }
            }

            var controllo = (10 - (dispari + pari) % 10) % 10;
            if (controllo == (int)Char.GetNumericValue(paramPI[paramPI.Length - 1])) return true;
            return false;
        }