icerpc / icerpc-csharp

A C# RPC framework built for QUIC, with bidirectional streaming, first-class async/await, and Protobuf support.
https://docs.icerpc.dev
Apache License 2.0
101 stars 13 forks source link

Use casts instead of 'as' conversions for decoding. #3915

Closed InsertCreativityHere closed 7 months ago

InsertCreativityHere commented 7 months ago

Currently, in the decoding logic, we use a mix of casts and as conversions. (Casts for decoding sequences, and as for dictionaries and results).

This PR changes the latter two to also use casts. And in the process, consolidates this logic into a new function: decode_type_with_cast.