ptupitsyn commented on a change in pull request #7628: IGNITE-7609 .NET: FieldsQueryCursor should expose data types too URL: https://github.com/apache/ignite/pull/7628#discussion_r405687502
########## File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs ########## @@ -85,5 +92,26 @@ public IList<string> FieldNames Target.OutStream(OpGetFieldNames, reader => reader.ReadStringCollection()))); } } + + /** <inheritdoc /> */ + public IList<IQueryCursorField> Fields + { + get + { + if (_fieldsMeta == null) + { + var metadata = Target.OutStream( + OpGetFieldsMeta, + reader => reader.ReadCollectionRaw(stream => + new QueryCursorField(stream) as IQueryCursorField)) + ?? new List<IQueryCursorField>(); + + _fieldsMeta = new ReadOnlyCollection<IQueryCursorField>( + metadata as List<IQueryCursorField> ?? metadata.ToList()); Review comment: `ToList` causes unnecessary allocations here. My proposal: * Remove `??` above, get the result of `ReadCollectionRaw` as is * `_fieldsMeta = meta != null ? meta.AsReadOnly() : new ReadOnlyCollection()` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services