3

次の文章を流暢に書く方法はありますか。

var someTypes = GetType()
    .Assembly
    .GetTypes()
    .Where(x => someFilter == true);

foreach(var someType in someTypes)
{
    var genericInterface = typeof(IFoo<>).MakeGenericType(someType);

    var genericImplementation = typeof(Foo<>).MakeGenericType(someType);

    container.Register(
       Component.For(genericInterface)
            .ImplementedBy(genericImplementation));
}
4

2 に答える 2