Skip to content

Commit

Permalink
fix comment, replace assert with ArgumentNullException.ThrowIfNull
Browse files Browse the repository at this point in the history
  • Loading branch information
krwq committed Aug 11, 2022
1 parent 823dd1c commit e60e59b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class XmlProcessingInstruction : XmlLinkedNode

protected internal XmlProcessingInstruction(string target, string? data, XmlDocument doc) : base(doc)
{
Debug.Assert(target != null, "All callsites should have already checked for null");
ArgumentNullException.ThrowIfNull(target);

if (string.IsNullOrEmpty(target))
if (target.Length == 0)
{
throw new ArgumentException(SR.Xml_EmptyName);
}
Expand All @@ -38,7 +38,7 @@ protected internal XmlProcessingInstruction(string target, string? data, XmlDocu
public override string Value
{
get => _data;
set { Data = value; } // use Data instead of data so that event will be fired
set { Data = value; } // use Data instead of data so that event will be fired and null will be normalized to empty string
}

// Gets the target of the processing instruction.
Expand Down Expand Up @@ -75,7 +75,7 @@ public string Data
public override string InnerText
{
get => _data;
set { Data = value; } // use Data instead of data so that change event will be fired
set { Data = value; } // use Data instead of data so that event will be fired and null will be normalized to empty string
}

/// <inheritdoc />
Expand Down

0 comments on commit e60e59b

Please sign in to comment.