@@ -115,10 +115,10 @@ private void ImplementRecursiveParentInterface()
115115 // this.Children;
116116 var thisDotChildren = Syntax . ThisDot ( SyntaxFactory . IdentifierName ( this . generator . applyToMetaType . RecursiveField . Name . ToPascalCase ( ) ) ) ;
117117
118- // System.Collections.Generic.IEnumerable <IRecursiveType> IRecursiveParent.Children
118+ // System.Collections.Generic.IReadOnlyCollection <IRecursiveType> IRecursiveParent.Children
119119 this . innerMembers . Add (
120120 SyntaxFactory . PropertyDeclaration (
121- Syntax . GetTypeSyntax ( typeof ( IEnumerable < IRecursiveType > ) ) ,
121+ Syntax . GetTypeSyntax ( typeof ( IReadOnlyCollection < IRecursiveType > ) ) ,
122122 nameof ( IRecursiveParent . Children ) )
123123 . WithExplicitInterfaceSpecifier ( SyntaxFactory . ExplicitInterfaceSpecifier ( Syntax . GetTypeSyntax ( typeof ( IRecursiveParent ) ) ) )
124124 . WithExpressionBody ( SyntaxFactory . ArrowExpressionClause ( thisDotChildren ) )
@@ -164,11 +164,11 @@ private void ImplementRecursiveParentInterface()
164164 SyntaxFactory . Argument ( SyntaxFactory . MemberAccessExpression ( SyntaxKind . SimpleMemberAccessExpression , parentedVar , SyntaxFactory . IdentifierName ( nameof ( ParentedRecursiveTypeNonGeneric . Value ) ) ) ) ,
165165 SyntaxFactory . Argument ( SyntaxFactory . MemberAccessExpression ( SyntaxKind . SimpleMemberAccessExpression , parentedVar , SyntaxFactory . IdentifierName ( nameof ( ParentedRecursiveTypeNonGeneric . Parent ) ) ) ) ) ) ) ) ) ;
166166
167- ////System.Collections.Generic.IEnumerable <<#= templateType.RecursiveType.TypeName #>> IRecursiveParent<<#= templateType.RecursiveType.TypeName #>>.Children
167+ ////System.Collections.Generic.IReadOnlyCollection <<#= templateType.RecursiveType.TypeName #>> IRecursiveParent<<#= templateType.RecursiveType.TypeName #>>.Children
168168 //// => return this.Children;
169169 this . innerMembers . Add (
170170 SyntaxFactory . PropertyDeclaration (
171- Syntax . IEnumerableOf ( this . generator . applyToMetaType . RecursiveType . TypeSyntax ) ,
171+ Syntax . IReadOnlyCollectionOf ( this . generator . applyToMetaType . RecursiveType . TypeSyntax ) ,
172172 nameof ( IRecursiveParent < IRecursiveType > . Children ) )
173173 . WithExplicitInterfaceSpecifier ( SyntaxFactory . ExplicitInterfaceSpecifier ( irecursiveParentOfT ) )
174174 . WithExpressionBody ( SyntaxFactory . ArrowExpressionClause ( thisDotChildren ) )
@@ -185,6 +185,15 @@ private void ImplementOrderedChildrenInterface()
185185 this . baseTypes . Add ( SyntaxFactory . SimpleBaseType ( Syntax . GetTypeSyntax ( typeof ( IRecursiveParentWithOrderedChildren ) ) ) ) ;
186186 }
187187
188+ // IReadOnlyList<IRecursiveType> IRecursiveParentWithOrderedChildren.Children => this.children;
189+ this . innerMembers . Add ( SyntaxFactory . PropertyDeclaration (
190+ Syntax . IReadOnlyListOf ( Syntax . GetTypeSyntax ( typeof ( IRecursiveType ) ) ) ,
191+ nameof ( IRecursiveParentWithOrderedChildren . Children ) )
192+ . WithExplicitInterfaceSpecifier ( SyntaxFactory . ExplicitInterfaceSpecifier ( SyntaxFactory . IdentifierName ( nameof ( IRecursiveParentWithOrderedChildren ) ) ) )
193+ . WithExpressionBody ( SyntaxFactory . ArrowExpressionClause ( Syntax . ThisDot ( SyntaxFactory . IdentifierName ( this . generator . applyToMetaType . RecursiveField . Name ) ) ) )
194+ . WithSemicolonToken ( SyntaxFactory . Token ( SyntaxKind . SemicolonToken ) )
195+ . AddAttributeLists ( SyntaxFactory . AttributeList ( SyntaxFactory . SingletonSeparatedList ( DebuggerBrowsableNeverAttribute ) ) ) ) ;
196+
188197 // int IRecursiveParentWithOrderedChildren.IndexOf(IRecursiveType value)
189198 var valueParameterName = SyntaxFactory . IdentifierName ( "value" ) ;
190199 this . innerMembers . Add ( SyntaxFactory . MethodDeclaration (
0 commit comments