Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ private void ImportDataMembers()
MemberInfo member = memberInfos[i];
if (HasDataContract)
{
object[] memberAttributes = member.GetCustomAttributes(typeof(DataMemberAttribute), false).ToArray();
object[] memberAttributes = member.GetCustomAttributes(typeof(DataMemberAttribute), false);
if (memberAttributes != null && memberAttributes.Length > 0)
{
if (memberAttributes.Length > 1)
Expand Down Expand Up @@ -885,7 +885,7 @@ private void ImportDataMembers()
if ((field == null && property == null) || (field != null && field.IsInitOnly))
continue;

object[] memberAttributes = member.GetCustomAttributes(typeof(IgnoreDataMemberAttribute), false).ToArray();
object[] memberAttributes = member.GetCustomAttributes(typeof(IgnoreDataMemberAttribute), false);
if (memberAttributes != null && memberAttributes.Length > 0)
{
if (memberAttributes.Length > 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ internal static bool TryGetDCAttribute(Type type, [NotNullWhen(true)] out DataCo
{
dataContractAttribute = null;

object[] dataContractAttributes = type.GetCustomAttributes(typeof(DataContractAttribute), false).ToArray();
object[] dataContractAttributes = type.GetCustomAttributes(typeof(DataContractAttribute), false);
if (dataContractAttributes != null && dataContractAttributes.Length > 0)
{
#if DEBUG
Expand All @@ -1390,7 +1390,7 @@ internal static XmlQualifiedName GetCollectionXmlName(Type type, Type itemType,
internal static XmlQualifiedName GetCollectionXmlName(Type type, Type itemType, HashSet<Type> previousCollectionTypes, out CollectionDataContractAttribute? collectionContractAttribute)
{
string? name, ns;
object[] collectionContractAttributes = type.GetCustomAttributes(typeof(CollectionDataContractAttribute), false).ToArray();
object[] collectionContractAttributes = type.GetCustomAttributes(typeof(CollectionDataContractAttribute), false);
if (collectionContractAttributes != null && collectionContractAttributes.Length > 0)
{
#if DEBUG
Expand Down Expand Up @@ -1973,7 +1973,7 @@ private static void ImportKnownTypeAttributes(Type? type, Dictionary<Type, Type>
return;

typesChecked.Add(type, type);
object[] knownTypeAttributes = type.GetCustomAttributes(typeof(KnownTypeAttribute), false).ToArray();
object[] knownTypeAttributes = type.GetCustomAttributes(typeof(KnownTypeAttribute), false);
if (knownTypeAttributes != null)
{
KnownTypeAttribute kt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Xml;
Expand Down Expand Up @@ -226,7 +225,7 @@ private void ImportDataMembers()
bool enumMemberValid = false;
if (_hasDataContract)
{
object[] memberAttributes = field.GetCustomAttributes(typeof(EnumMemberAttribute), false).ToArray();
object[] memberAttributes = field.GetCustomAttributes(typeof(EnumMemberAttribute), false);
if (memberAttributes != null && memberAttributes.Length > 0)
{
if (memberAttributes.Length > 1)
Expand All @@ -247,7 +246,7 @@ private void ImportDataMembers()
enumMemberValid = true;
}

object[] dataMemberAttributes = field.GetCustomAttributes(typeof(DataMemberAttribute), false).ToArray();
object[] dataMemberAttributes = field.GetCustomAttributes(typeof(DataMemberAttribute), false);
if (dataMemberAttributes != null && dataMemberAttributes.Length > 0)
ThrowInvalidDataContractException(SR.Format(SR.DataMemberOnEnumField, DataContract.GetClrTypeFullName(field.DeclaringType!), field.Name));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
Expand Down Expand Up @@ -151,7 +150,7 @@ internal XmlDataContractCriticalHelper(
XmlDictionary dictionary = new XmlDictionary();
Name = dictionary.Add(XmlName.Name);
Namespace = dictionary.Add(XmlName.Namespace);
object[]? xmlRootAttributes = UnderlyingType?.GetCustomAttributes(typeof(XmlRootAttribute), false).ToArray();
object[]? xmlRootAttributes = UnderlyingType?.GetCustomAttributes(typeof(XmlRootAttribute), false);
if (xmlRootAttributes == null || xmlRootAttributes.Length == 0)
{
if (hasRoot)
Expand Down
Loading