Skip to content

Commit

Permalink
Fix XStreamingElement ctor to take nullable content
Browse files Browse the repository at this point in the history
  • Loading branch information
krwq committed Oct 26, 2020
1 parent f400837 commit 4889c0e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ internal async Task WriteContentToAsync(XmlWriter writer, CancellationToken canc
}
}

private static void AddContentToList(List<object> list, object content)
private static void AddContentToList(List<object?> list, object? content)
{
IEnumerable? e = content is string ? null : content as IEnumerable;
if (e == null)
Expand All @@ -1409,7 +1409,7 @@ private static void AddContentToList(List<object> list, object content)
internal static object? GetContentSnapshot(object? content)
{
if (content is string || !(content is IEnumerable)) return content;
List<object> list = new List<object>();
List<object?> list = new List<object?>();
AddContentToList(list, content);
return list;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public XStreamingElement(XName name)
/// </summary>
/// <param name="name">The name to assign to the new <see cref="XStreamingElement"/> node</param>
/// <param name="content">The content to assign to the new <see cref="XStreamingElement"/> node</param>
public XStreamingElement(XName name, object content)
public XStreamingElement(XName name, object? content)
: this(name)
{
this.content = content is List<object> ? new object[] { content } : content;
this.content = content is List<object?> ? new object?[] { content } : content;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public override void WriteTo(System.Xml.XmlWriter writer) { }
public partial class XStreamingElement
{
public XStreamingElement(System.Xml.Linq.XName name) { }
public XStreamingElement(System.Xml.Linq.XName name, object content) { }
public XStreamingElement(System.Xml.Linq.XName name, object? content) { }
public XStreamingElement(System.Xml.Linq.XName name, params object?[] content) { }
public System.Xml.Linq.XName Name { get { throw null; } set { } }
public void Add(object? content) { }
Expand Down

0 comments on commit 4889c0e

Please sign in to comment.