diff --git a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XContainer.cs b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XContainer.cs
index 325c00d90cfc9..1a0d8492fd2fe 100644
--- a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XContainer.cs
+++ b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XContainer.cs
@@ -165,16 +165,16 @@ public void Add(object? content)
AddNode(new XElement(x));
return;
}
- object[]? o = content as object[];
+ object?[]? o = content as object?[];
if (o != null)
{
- foreach (object obj in o) Add(obj);
+ foreach (object? obj in o) Add(obj);
return;
}
IEnumerable? e = content as IEnumerable;
if (e != null)
{
- foreach (object obj in e) Add(obj);
+ foreach (object? obj in e) Add(obj);
return;
}
AddString(GetStringValue(content));
@@ -190,7 +190,7 @@ public void Add(object? content)
/// See XContainer.Add(object content) for details about the content that can be added
/// using this method.
///
- public void Add(params object[] content)
+ public void Add(params object?[] content)
{
Add((object)content);
}
@@ -229,7 +229,7 @@ public void AddFirst(object? content)
///
/// Thrown if the parent is null.
///
- public void AddFirst(params object[] content)
+ public void AddFirst(params object?[] content)
{
AddFirst((object)content);
}
@@ -452,7 +452,7 @@ public void ReplaceNodes(object? content)
/// See XContainer.Add(object content) for details about the content that can be added
/// using this method.
///
- public void ReplaceNodes(params object[] content)
+ public void ReplaceNodes(params object?[] content)
{
ReplaceNodes((object)content);
}
@@ -492,16 +492,16 @@ internal void AddContentSkipNotify(object? content)
AddNodeSkipNotify(new XElement(x));
return;
}
- object[]? o = content as object[];
+ object?[]? o = content as object?[];
if (o != null)
{
- foreach (object obj in o) AddContentSkipNotify(obj);
+ foreach (object? obj in o) AddContentSkipNotify(obj);
return;
}
IEnumerable? e = content as IEnumerable;
if (e != null)
{
- foreach (object obj in e) AddContentSkipNotify(obj);
+ foreach (object? obj in e) AddContentSkipNotify(obj);
return;
}
AddStringSkipNotify(GetStringValue(content));
@@ -1389,7 +1389,7 @@ internal async Task WriteContentToAsync(XmlWriter writer, CancellationToken canc
}
}
- private static void AddContentToList(List list, object content)
+ private static void AddContentToList(List list, object? content)
{
IEnumerable? e = content is string ? null : content as IEnumerable;
if (e == null)
@@ -1398,7 +1398,7 @@ private static void AddContentToList(List list, object content)
}
else
{
- foreach (object obj in e)
+ foreach (object? obj in e)
{
if (obj != null) AddContentToList(list, obj);
}
@@ -1409,7 +1409,7 @@ private static void AddContentToList(List list, object content)
internal static object? GetContentSnapshot(object? content)
{
if (content is string || !(content is IEnumerable)) return content;
- List list = new List();
+ List list = new List();
AddContentToList(list, content);
return list;
}
diff --git a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XDocument.cs b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XDocument.cs
index 5ee37a8fe6ddc..9afbc2ba9431e 100644
--- a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XDocument.cs
+++ b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XDocument.cs
@@ -59,7 +59,7 @@ public XDocument()
/// See for details about the content that can be added
/// using this method.
///
- public XDocument(params object[] content)
+ public XDocument(params object?[] content)
: this()
{
AddContentSkipNotify(content);
@@ -87,7 +87,7 @@ public XDocument(params object[] content)
/// See for details about the content that can be added
/// using this method.
///
- public XDocument(XDeclaration? declaration, params object[] content)
+ public XDocument(XDeclaration? declaration, params object?[] content)
: this(content)
{
_declaration = declaration;
diff --git a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs
index 8b595a34e5f96..283b42a82e6cd 100644
--- a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs
+++ b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs
@@ -92,7 +92,7 @@ public XElement(XName name, object? content)
/// See XContainer.Add(object content) for details about the content that can be added
/// using this method.
///
- public XElement(XName name, params object[] content) : this(name, (object)content) { }
+ public XElement(XName name, params object?[] content) : this(name, (object)content) { }
///
/// Initializes a new instance of the XElement class from another XElement object.
@@ -983,7 +983,7 @@ public void ReplaceAll(object? content)
/// See XContainer.Add(object content) for details about the content that can be added
/// using this method.
///
- public void ReplaceAll(params object[] content)
+ public void ReplaceAll(params object?[] content)
{
ReplaceAll((object)content);
}
@@ -1020,7 +1020,7 @@ public void ReplaceAttributes(object? content)
/// See XContainer.Add(object content) for details about the content that can be added
/// using this method.
///
- public void ReplaceAttributes(params object[] content)
+ public void ReplaceAttributes(params object?[] content)
{
ReplaceAttributes((object)content);
}
diff --git a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XLinq.cs b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XLinq.cs
index 0d47b5596cdc4..b27a85a49ea15 100644
--- a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XLinq.cs
+++ b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XLinq.cs
@@ -95,16 +95,16 @@ private void AddContent(object? content)
AddNode(new XElement(x));
return;
}
- object[]? o = content as object[];
+ object?[]? o = content as object?[];
if (o != null)
{
- foreach (object obj in o) AddContent(obj);
+ foreach (object? obj in o) AddContent(obj);
return;
}
IEnumerable? e = content as IEnumerable;
if (e != null)
{
- foreach (object obj in e) AddContent(obj);
+ foreach (object? obj in e) AddContent(obj);
return;
}
if (content is XAttribute) throw new ArgumentException(SR.Argument_AddAttribute);
diff --git a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XNode.cs b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XNode.cs
index aa34604d8a05b..389b9dc576714 100644
--- a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XNode.cs
+++ b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XNode.cs
@@ -138,7 +138,7 @@ public void AddAfterSelf(object? content)
///
/// Thrown if the parent is null.
///
- public void AddAfterSelf(params object[] content)
+ public void AddAfterSelf(params object?[] content)
{
AddAfterSelf((object)content);
}
@@ -185,7 +185,7 @@ public void AddBeforeSelf(object? content)
///
/// Thrown if the parent is null.
///
- public void AddBeforeSelf(params object[] content)
+ public void AddBeforeSelf(params object?[] content)
{
AddBeforeSelf((object)content);
}
@@ -567,7 +567,7 @@ public void ReplaceWith(object? content)
/// Replaces this node with the specified content.
///
/// Content that replaces this node.
- public void ReplaceWith(params object[] content)
+ public void ReplaceWith(params object?[] content)
{
ReplaceWith((object)content);
}
diff --git a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XStreamingElement.cs b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XStreamingElement.cs
index d8a71a9c203f7..4e9373f031b1c 100644
--- a/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XStreamingElement.cs
+++ b/src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XStreamingElement.cs
@@ -32,10 +32,10 @@ public XStreamingElement(XName name)
///
/// The name to assign to the new node
/// The content to assign to the new node
- public XStreamingElement(XName name, object content)
+ public XStreamingElement(XName name, object? content)
: this(name)
{
- this.content = content is List ? new object[] { content } : content;
+ this.content = content is List ? new object?[] { content } : content;
}
///
@@ -43,7 +43,7 @@ public XStreamingElement(XName name, object content)
///
/// The name to assign to the new node
/// An array containing content to assign to the new node
- public XStreamingElement(XName name, params object[] content)
+ public XStreamingElement(XName name, params object?[] content)
: this(name)
{
this.content = content;
@@ -88,7 +88,7 @@ public void Add(object? content)
/// Add content to an
///
/// array of objects containing content to add
- public void Add(params object[] content)
+ public void Add(params object?[] content)
{
Add((object)content);
}
diff --git a/src/libraries/System.Xml.XDocument/ref/System.Xml.XDocument.cs b/src/libraries/System.Xml.XDocument/ref/System.Xml.XDocument.cs
index 2f0a98f962e8d..5849d80eb2d5b 100644
--- a/src/libraries/System.Xml.XDocument/ref/System.Xml.XDocument.cs
+++ b/src/libraries/System.Xml.XDocument/ref/System.Xml.XDocument.cs
@@ -150,9 +150,9 @@ internal XContainer() { }
public System.Xml.Linq.XNode? FirstNode { get { throw null; } }
public System.Xml.Linq.XNode? LastNode { get { throw null; } }
public void Add(object? content) { }
- public void Add(params object[] content) { }
+ public void Add(params object?[] content) { }
public void AddFirst(object? content) { }
- public void AddFirst(params object[] content) { }
+ public void AddFirst(params object?[] content) { }
public System.Xml.XmlWriter CreateWriter() { throw null; }
public System.Collections.Generic.IEnumerable DescendantNodes() { throw null; }
public System.Collections.Generic.IEnumerable Descendants() { throw null; }
@@ -163,7 +163,7 @@ public void AddFirst(params object[] content) { }
public System.Collections.Generic.IEnumerable Nodes() { throw null; }
public void RemoveNodes() { }
public void ReplaceNodes(object? content) { }
- public void ReplaceNodes(params object[] content) { }
+ public void ReplaceNodes(params object?[] content) { }
}
public partial class XDeclaration
{
@@ -177,8 +177,8 @@ public XDeclaration(System.Xml.Linq.XDeclaration other) { }
public partial class XDocument : System.Xml.Linq.XContainer
{
public XDocument() { }
- public XDocument(params object[] content) { }
- public XDocument(System.Xml.Linq.XDeclaration? declaration, params object[] content) { }
+ public XDocument(params object?[] content) { }
+ public XDocument(System.Xml.Linq.XDeclaration? declaration, params object?[] content) { }
public XDocument(System.Xml.Linq.XDocument other) { }
public System.Xml.Linq.XDeclaration? Declaration { get { throw null; } set { } }
public System.Xml.Linq.XDocumentType? DocumentType { get { throw null; } }
@@ -229,7 +229,7 @@ public partial class XElement : System.Xml.Linq.XContainer, System.Xml.Serializa
public XElement(System.Xml.Linq.XElement other) { }
public XElement(System.Xml.Linq.XName name) { }
public XElement(System.Xml.Linq.XName name, object? content) { }
- public XElement(System.Xml.Linq.XName name, params object[] content) { }
+ public XElement(System.Xml.Linq.XName name, params object?[] content) { }
public XElement(System.Xml.Linq.XStreamingElement other) { }
public static System.Collections.Generic.IEnumerable EmptySequence { get { throw null; } }
public System.Xml.Linq.XAttribute? FirstAttribute { get { throw null; } }
@@ -330,9 +330,9 @@ public XElement(System.Xml.Linq.XStreamingElement other) { }
public void RemoveAll() { }
public void RemoveAttributes() { }
public void ReplaceAll(object? content) { }
- public void ReplaceAll(params object[] content) { }
+ public void ReplaceAll(params object?[] content) { }
public void ReplaceAttributes(object? content) { }
- public void ReplaceAttributes(params object[] content) { }
+ public void ReplaceAttributes(params object?[] content) { }
public void Save(System.IO.Stream stream) { }
public void Save(System.IO.Stream stream, System.Xml.Linq.SaveOptions options) { }
public void Save(System.IO.TextWriter textWriter) { }
@@ -398,9 +398,9 @@ internal XNode() { }
public System.Xml.Linq.XNode? NextNode { get { throw null; } }
public System.Xml.Linq.XNode? PreviousNode { get { throw null; } }
public void AddAfterSelf(object? content) { }
- public void AddAfterSelf(params object[] content) { }
+ public void AddAfterSelf(params object?[] content) { }
public void AddBeforeSelf(object? content) { }
- public void AddBeforeSelf(params object[] content) { }
+ public void AddBeforeSelf(params object?[] content) { }
public System.Collections.Generic.IEnumerable Ancestors() { throw null; }
public System.Collections.Generic.IEnumerable Ancestors(System.Xml.Linq.XName? name) { throw null; }
public static int CompareDocumentOrder(System.Xml.Linq.XNode? n1, System.Xml.Linq.XNode? n2) { throw null; }
@@ -419,7 +419,7 @@ public void AddBeforeSelf(params object[] content) { }
public static System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader, System.Threading.CancellationToken cancellationToken) { throw null; }
public void Remove() { }
public void ReplaceWith(object? content) { }
- public void ReplaceWith(params object[] content) { }
+ public void ReplaceWith(params object?[] content) { }
public override string ToString() { throw null; }
public string ToString(System.Xml.Linq.SaveOptions options) { throw null; }
public abstract void WriteTo(System.Xml.XmlWriter writer);
@@ -488,11 +488,11 @@ 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, params 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) { }
- public void Add(params object[] content) { }
+ public void Add(params object?[] content) { }
public void Save(System.IO.Stream stream) { }
public void Save(System.IO.Stream stream, System.Xml.Linq.SaveOptions options) { }
public void Save(System.IO.TextWriter textWriter) { }