Skip to content

Conversation

@rolfbjarne
Copy link
Member

No description provided.

@rolfbjarne rolfbjarne requested a review from Copilot December 18, 2025 19:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a convenience method TryGetStringValue to the PDictionary class that simplifies retrieving string values from property list dictionaries without requiring explicit handling of the PString wrapper type.

Key Changes:

  • Added TryGetStringValue method that returns the underlying string value directly instead of requiring callers to unwrap PString objects

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +680 to +689
public bool TryGetStringValue (string key, [NotNullWhen (true)] out string? value)
{
if (TryGetValue<PString> (key, out var obj)) {
value = obj.Value;
return true;
}

value = null;
return false;
}
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The new TryGetStringValue method lacks test coverage. Consider adding tests to verify:

  • Successful retrieval of a string value when the key exists and contains a PString
  • Returning false and null when the key doesn't exist
  • Returning false and null when the key exists but contains a non-string value (e.g., PNumber, PBoolean)

This is especially important since the existing TryGetValue method has comprehensive test coverage in PListObjectTests.cs.

Copilot uses AI. Check for mistakes.
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.

2 participants