Skip to content

remove redundant nullable #4608

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

SimonCropp
Copy link
Contributor

No description provided.

Copy link
Contributor

@StefanOssendorf StefanOssendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching these. Probably left overs from my work. I appreciate it!

@StefanOssendorf
Copy link
Contributor

Ah please solve the conflict. Thanks

@@ -136,7 +136,7 @@ protected virtual void OnGetChildren(SerializationInfo info, MobileFormatter for
List<int> references = new List<int>();
for (int x = 0; x < Count; x++)
{
T? child = this[x];
T child = this[x];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this still be T?` because of the next line? Otherwise the check could be removed due to the missing annotation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no because MobileObservableCollection<T> has no notnull constraint.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But exactly because of that we have to assume it can be nullable.
So T? child is more correct than T. With T we don't express the possibility of the child being null so the compiler can help us avoiding possible null errors?

@StefanOssendorf StefanOssendorf self-requested a review March 23, 2025 21:35
@StefanOssendorf StefanOssendorf dismissed their stale review March 23, 2025 21:36

Question arose

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

Successfully merging this pull request may close these issues.

3 participants