Skip to content
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

You avoid unnecessary iterations over the list when accessing the counts. #5

Open
bierquelle06 opened this issue Aug 22, 2023 · 0 comments

Comments

@bierquelle06
Copy link
Member

...\src\AdsPush.Abstraction\Firebase\FirebaseNotificationBatchResult.cs

By calculating the counts in the constructor and storing them directly in separate properties (SuccessCount and FailedCount),
you avoid unnecessary iterations over the list when accessing the counts.
This can help improve the performance, especially if the list of NotificationResults is large.

///


/// The notification count that is
/// successfully accepted by FCM.
///

public int SuccessCount => this.NotificationResults.Count(x => x.IsSuccess);

///


/// The notification count that is NOT accepted by FCM.
///

public int FailedCount => this.NotificationResults.Count(x => !x.IsSuccess);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant