C#
C#

help

Root Question Message

fenixblades
fenixblades11/11/2022
❔ Why wont visual studio auto format this with CTRL K + CTRL D?

can anyone think of why visual studio wont format these lambda arrows with CTRL K + CTRL D but it will format things around it like spacing between semicolons?
var exportBatchInputs = new List<TbExportBatchInput>()
{
    TestHelper.Fixture.Build<TbExportBatchInput>()
    .With(c => c.ExportBatchId, TestHelper.BatchID)
    .With(c=>c.FieldName, "PO Box") // note the spacing between the fat arrow here
    .With(c=>c.FieldData, "12345") // note the spacing between the fat arrow here
    .Create()
};

if i do something like this
var foo = ()=>5;

it correctly auto formats it to
var foo = () => 5;

so im not sure what the difference is in context between those 2 that would cause visual studio to not format the first instance.
Yawnder
Yawnder11/12/2022
@98933406267617280 Because in the first case you basically already told the IDE that you didn't want to follow a regular formatting style.
Yawnder
Yawnder11/12/2022
Your .With at the same depth as your TestHelper, for example.
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy