using System.Collections.Generic;
public static void Main()
List<Scaglione> irpef = new List<Scaglione> {
new Scaglione(){ QuotaMin = 0M, QuotaMax = 8174M, TaxPerc = 0 },
new Scaglione(){ QuotaMin = 8174.01M, QuotaMax = 15000M, TaxPerc = 23 },
new Scaglione(){ QuotaMin = 15000.01M, QuotaMax = 28000M, TaxPerc = 25 },
new Scaglione(){ QuotaMin = 28000.01M, QuotaMax = 50000M, TaxPerc = 35 },
new Scaglione(){ QuotaMin = 50000.01M, QuotaMax = int.MaxValue, TaxPerc = 43 }
decimal reddito = 16000M;
Scaglione ultimoScaglione = irpef.Where(w => (reddito >= w.QuotaMin && reddito <= w.QuotaMax)).FirstOrDefault();
for(int i = 0; i <= irpef.IndexOf(ultimoScaglione); i++)
Scaglione scagl = irpef[i];
if(scagl.QuotaMax < reddito) tassabile = (scagl.QuotaMax - scagl.QuotaMin);
else tassabile = reddito - scagl.QuotaMin;
decimal tassePagate = tassabile * (scagl.TaxPerc / 100);
Console.WriteLine("Tasse Pagate nello Scaglione N°{0}: {1:0.00} €", i, tassePagate);
public decimal QuotaMin { set; get; }
public decimal QuotaMax { set; get; }
public decimal TaxPerc { set; get; }