I'm designing a configurable api and I've seen a few ways to accept options from the caller.
One is using an options object like so:
var options = new MyApiConfigurationOptions {
Option1 = true,
Option2 = false
};
var api1 = MyApiFactory.Create(options);
Another is using a configuration function:
var api2 = MyApiFactory.Create(o => {
o.Option1 = true;
o.Option2 = false;
});
Is one approach any better/worse/different than the other? Is there any real difference or would it be nice to support both so the caller can use whatever syntax they prefer?