Skip to content

Refactor: Adopt nullable types and modern C# conventions#15

Merged
kzu merged 1 commit intomasterfrom
dev/nullable
Mar 29, 2026
Merged

Refactor: Adopt nullable types and modern C# conventions#15
kzu merged 1 commit intomasterfrom
dev/nullable

Conversation

@kzu
Copy link
Copy Markdown
Member

@kzu kzu commented Mar 29, 2026

Modernized the codebase by adopting nullable reference types (string?, XPathExpression?, etc.) to improve null safety and align with modern C# practices. Updated null checks to use is not null for better readability.

Introduced default initialization for properties (e.g., Schema.Empty, NullMatchedNodes.Instance) and added sentinel values to replace nulls in certain cases. Improved null handling in methods by throwing exceptions when required fields are uninitialized.

Refactored the Reset method for clarity, reused StringBuilder instances to improve memory efficiency, and guarded against nulls with the null-forgiving operator (!) where appropriate.

Enhanced dictionary merging logic for clarity, added [MemberNotNull] attributes to guarantee non-null fields after method execution, and improved conditional logic readability.

Refactored validation logic in Validator to simplify error handling and replaced nullable StringBuilder instances with string variables. Applied general code cleanup, including consistent formatting and spacing, to improve maintainability.

Modernized the codebase by adopting nullable reference types (`string?`, `XPathExpression?`, etc.) to improve null safety and align with modern C# practices. Updated null checks to use `is not null` for better readability.

Introduced default initialization for properties (e.g., `Schema.Empty`, `NullMatchedNodes.Instance`) and added sentinel values to replace nulls in certain cases. Improved null handling in methods by throwing exceptions when required fields are uninitialized.

Refactored the `Reset` method for clarity, reused `StringBuilder` instances to improve memory efficiency, and guarded against nulls with the null-forgiving operator (`!`) where appropriate.

Enhanced dictionary merging logic for clarity, added `[MemberNotNull]` attributes to guarantee non-null fields after method execution, and improved conditional logic readability.

Refactored validation logic in `Validator` to simplify error handling and replaced nullable `StringBuilder` instances with string variables. Applied general code cleanup, including consistent formatting and spacing, to improve maintainability.
@kzu kzu enabled auto-merge (rebase) March 29, 2026 22:00
@kzu
Copy link
Copy Markdown
Member Author

kzu commented Mar 29, 2026

49 passed 49 passed

🧪 Details on Ubuntu 24.04.4 LTS

from retest v1.1.0 on .NET 10.0.5 with 💜 by @devlooped

@kzu kzu merged commit 93c94b5 into master Mar 29, 2026
4 checks passed
@kzu kzu deleted the dev/nullable branch March 29, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant