Refactor switch cases and improve string formatting#1659
Merged
Conversation
sipsorcery
reviewed
Jun 1, 2026
sipsorcery
requested changes
Jun 1, 2026
| // PLI feedback reports do no have any additional parameters. | ||
| break; | ||
| case var x when x.PacketType == RTCPReportTypesEnum.RTPFB: | ||
| case var _ when Header.PacketType == RTCPReportTypesEnum.RTPFB: |
Member
There was a problem hiding this comment.
Looks like this one was missed.
Refactored switch-case statements in RTCPFeedback.cs to use the Header property directly for pattern matching, enhancing clarity. Updated exception message in RTCPHeader.cs to use string interpolation. Simplified ToString() in RTCPTWCCFeedback.cs to use a single interpolated string for better readability.
Renamed the pattern variable in switch cases from '_' to 'h' to improve readability and allow direct access to the matched object. No logic changes were made.
Updated the switch statement to use pattern matching (case var h when h.PacketType == RTCPReportTypesEnum.RTPFB), enabling access to the matched variable within the case block for improved clarity and maintainability.
sipsorcery
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactored switch-case statements in RTCPFeedback.cs to use the Header property directly for pattern matching, enhancing clarity. Updated exception message in RTCPHeader.cs to use string interpolation. Simplified ToString() in RTCPTWCCFeedback.cs to use a single interpolated string for better readability.
Split of #1639