C#语法解读
1,在this IServiceCollection services中,this是什么作用?
2,在Action builderAction中,>是什么作用?
3,在 => services和s =>中,=>是什么作用,两处有什么区别?
#region Add General Purpose Service
public static IServiceCollection AddDicomServer(this IServiceCollection services, Action<DicomServerServiceOptions> optionsAction, Action<DicomServiceBuilder> builderAction)
=> services
.UseFellowOakDicom()
.AddTransient<IHostedService>(s =>
{
var builder = new DicomServiceBuilder();
builderAction(builder);
var dicomService = new GeneralPurposeDicomServerService(s.GetRequiredService<IConfiguration>(), s.GetRequiredService<IDicomServerFactory>(), builder);
optionsAction(dicomService.Options);
return dicomService;
});
#endregion