How do I assign a property on only a subrange of items in a list?
问题 I want to create a list of custom objects using AutoFixture . I want the first N objects to have a property set to one value, and the remainder to have it set to another value (or to simply be set by the Fixture 's default strategy). I am aware that I can use Fixture.CreateMany<T>.With , but this applies a function to all members of the list. In NBuilder there are methods named TheFirst and TheNext (among others) which provide this functionality. An example of their use: Given a class Foo :