Deciding between interfaces and concrete classes
In this section, we will show that declaring a collection using an interface declaration rather than a concrete class declaration provides better time-based performance. We will accomplish this by benchmarking the generation of collections using an IList interface, as well as by using a List concrete class, so that you can see the difference in the performance of the different approaches. Follow these steps:
- In the
CH06_Collectionsproject, add a new folder calledConcreteVsInterface. - In the
ConcreteVsInterfacefolder, add theITaxinterface:internal interface ITax { Â Â Â Â Â Â int Id { get; set; } Â Â Â Â Â Â TaxType TaxType { get; set; } Â Â Â Â Â Â TaxRate TaxRate { get; set; } Â Â Â Â Â Â decimal LowerLimit { get; set; } Â Â Â Â Â Â decimal UpperLimit { get; set; } Â Â Â Â Â Â ...