-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rank is non-zero for non-arrays #32
Comments
Furthermore, I see that 1-rank arrays take the |
That comment is misleading, it is meant to reflect the dimensionality of collection types in general. rank-1 arrays and
Every
Yeah, the problem with array is that you need to be able to know its length ahead of time, which for many wire formats isn't available before having read their entire payload. What I've been doing for the case of CBOR which is optionally length-prefixed is use a Assuming MessagePack is always length-prefixed you could conceivably use a specialized converter for arrays that deserialized to the final buffer directly. Specializing converters is fairly easy within visitors, here's an example of this happening for rank-N arrays in the JSON serializer: |
Yes, that's exactly what I settled on last night, and I used that json sample as inspiration. |
The xml doc comment on the
Rank
property suggests that it is non-zero only for arrays:https://github.com/eiriktsarpalis/typeshape-csharp/blob/fcbaf23466f745a37ef2e892b3e660afe5f69d43/src/TypeShape/Abstractions/IEnumerableTypeShape.cs#L26-L29
But in fact it is
1
forIEnumerable<T>
.There is nothing in the
IEnumerableTypeShape
to definitely identify an array, I guess. I'm going to try to 'guess' by having a combination ofCollectionConstructionStrategy.None
and a rank > 0.The text was updated successfully, but these errors were encountered: