Using FluentValidation's WithMessage method with a list of named parameters
I am using FluentValidation and I want to format a message with some of the object's properties value. The problem is I have very little experience with expressions and delegates in C#. FluentValidation already provides a way to do this with format arguments. RuleFor(x => x.Name).NotEmpty() .WithMessage("The name {1} is not valid for Id {0}", x => x.Id, x => x.Name); I would like to do something like this to avoid having to change the message string if I change the order of the parameters. RuleFor(x => x.Name).NotEmpty() .WithMessage("The name {Name} is not valid for Id {Id}", x => new { Id =