@@ -329,7 +329,11 @@ private static AnonymousObjectCreationExpressionSyntax ConvertToAnonymousType(
329329 if ( semanticModel != null )
330330 {
331331 fullyQualifiedNames = new Dictionary < ObjectCreationExpressionSyntax , string > ( ) ;
332- CollectFullyQualifiedNames ( objectCreation . Initializer , semanticModel , fullyQualifiedNames ) ;
332+ CollectFullyQualifiedNames (
333+ objectCreation . Initializer ,
334+ semanticModel ,
335+ fullyQualifiedNames
336+ ) ;
333337 }
334338
335339 var members = new List < AnonymousObjectMemberDeclaratorSyntax > ( ) ;
@@ -342,9 +346,10 @@ private static AnonymousObjectCreationExpressionSyntax ConvertToAnonymousType(
342346 if ( assignment . Left is IdentifierNameSyntax identifier )
343347 {
344348 // If we have fully qualified names, apply them to nested object creations
345- var processedRight = fullyQualifiedNames != null
346- ? ApplyFullyQualifiedNames ( assignment . Right , fullyQualifiedNames )
347- : assignment . Right ;
349+ var processedRight =
350+ fullyQualifiedNames != null
351+ ? ApplyFullyQualifiedNames ( assignment . Right , fullyQualifiedNames )
352+ : assignment . Right ;
348353
349354 // Create the name equals with preserved identifier trivia
350355 var nameEquals = SyntaxFactory
@@ -376,17 +381,20 @@ private static AnonymousObjectCreationExpressionSyntax ConvertToAnonymousType(
376381 . AddRange ( objectCreation . Type . GetLeadingTrivia ( ) )
377382 . AddRange ( objectCreation . Type . GetTrailingTrivia ( ) ) ;
378383 }
379-
384+
380385 // Create anonymous object creation preserving trivia
381386 var result = SyntaxFactory
382387 . AnonymousObjectCreationExpression (
383- SyntaxFactory . Token ( SyntaxKind . NewKeyword )
388+ SyntaxFactory
389+ . Token ( SyntaxKind . NewKeyword )
384390 . WithLeadingTrivia ( objectCreation . GetLeadingTrivia ( ) )
385391 . WithTrailingTrivia ( triviaBeforeOpenBrace ) ,
386- SyntaxFactory . Token ( SyntaxKind . OpenBraceToken )
392+ SyntaxFactory
393+ . Token ( SyntaxKind . OpenBraceToken )
387394 . WithTrailingTrivia ( objectCreation . Initializer . OpenBraceToken . TrailingTrivia ) ,
388395 separatedMembers ,
389- SyntaxFactory . Token ( SyntaxKind . CloseBraceToken )
396+ SyntaxFactory
397+ . Token ( SyntaxKind . CloseBraceToken )
390398 . WithLeadingTrivia ( objectCreation . Initializer . CloseBraceToken . LeadingTrivia )
391399 . WithTrailingTrivia ( objectCreation . Initializer . CloseBraceToken . TrailingTrivia )
392400 )
@@ -401,7 +409,9 @@ private static void CollectFullyQualifiedNames(
401409 Dictionary < ObjectCreationExpressionSyntax , string > fullyQualifiedNames
402410 )
403411 {
404- foreach ( var objectCreation in node . DescendantNodes ( ) . OfType < ObjectCreationExpressionSyntax > ( ) )
412+ foreach (
413+ var objectCreation in node . DescendantNodes ( ) . OfType < ObjectCreationExpressionSyntax > ( )
414+ )
405415 {
406416 var typeInfo = semanticModel . GetTypeInfo ( objectCreation ) ;
407417 if ( typeInfo . Type != null )
@@ -444,7 +454,8 @@ ObjectCreationExpressionSyntax node
444454 var qualifiedType = SyntaxFactory . ParseTypeName ( fullyQualifiedName ) ;
445455
446456 // Create new object creation with fully qualified type, preserving trivia
447- var newNode = SyntaxFactory . ObjectCreationExpression ( qualifiedType )
457+ var newNode = SyntaxFactory
458+ . ObjectCreationExpression ( qualifiedType )
448459 . WithArgumentList ( node . ArgumentList )
449460 . WithInitializer ( node . Initializer )
450461 . WithLeadingTrivia ( node . GetLeadingTrivia ( ) )
@@ -493,7 +504,8 @@ ObjectCreationExpressionSyntax node
493504 var qualifiedType = SyntaxFactory . ParseTypeName ( fullyQualifiedName ) ;
494505
495506 // Create new object creation with fully qualified type, preserving trivia
496- var newNode = SyntaxFactory . ObjectCreationExpression ( qualifiedType )
507+ var newNode = SyntaxFactory
508+ . ObjectCreationExpression ( qualifiedType )
497509 . WithArgumentList ( node . ArgumentList )
498510 . WithInitializer ( node . Initializer )
499511 . WithLeadingTrivia ( node . GetLeadingTrivia ( ) )
0 commit comments