diff --git a/YamlDotNet.Samples/ConvertYamlToJson.cs b/YamlDotNet.Samples/ConvertYamlToJson.cs index 9ad59e5bb..4639a4bc6 100644 --- a/YamlDotNet.Samples/ConvertYamlToJson.cs +++ b/YamlDotNet.Samples/ConvertYamlToJson.cs @@ -20,7 +20,6 @@ // SOFTWARE. using System.IO; -using Xunit.Abstractions; using YamlDotNet.Samples.Helpers; using YamlDotNet.Serialization; diff --git a/YamlDotNet.Samples/DeserializeObjectGraph.cs b/YamlDotNet.Samples/DeserializeObjectGraph.cs index 24303aa4c..9833bc314 100644 --- a/YamlDotNet.Samples/DeserializeObjectGraph.cs +++ b/YamlDotNet.Samples/DeserializeObjectGraph.cs @@ -22,7 +22,7 @@ using System; using System.Collections.Generic; using System.IO; -using Xunit.Abstractions; + using YamlDotNet.Samples.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; diff --git a/YamlDotNet.Samples/DeserializingMultipleDocuments.cs b/YamlDotNet.Samples/DeserializingMultipleDocuments.cs index 8350fe933..73009ad38 100644 --- a/YamlDotNet.Samples/DeserializingMultipleDocuments.cs +++ b/YamlDotNet.Samples/DeserializingMultipleDocuments.cs @@ -21,7 +21,6 @@ using System.Collections.Generic; using System.IO; -using Xunit.Abstractions; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Samples.Helpers; diff --git a/YamlDotNet.Samples/LoadingAYamlStream.cs b/YamlDotNet.Samples/LoadingAYamlStream.cs index d5d210892..4c3bff249 100644 --- a/YamlDotNet.Samples/LoadingAYamlStream.cs +++ b/YamlDotNet.Samples/LoadingAYamlStream.cs @@ -20,7 +20,6 @@ // SOFTWARE. using System.IO; -using Xunit.Abstractions; using YamlDotNet.RepresentationModel; using YamlDotNet.Samples.Helpers; diff --git a/YamlDotNet.Samples/SerializeObjectGraph.cs b/YamlDotNet.Samples/SerializeObjectGraph.cs index b73b57446..8fa23f6b1 100644 --- a/YamlDotNet.Samples/SerializeObjectGraph.cs +++ b/YamlDotNet.Samples/SerializeObjectGraph.cs @@ -20,7 +20,6 @@ // SOFTWARE. using System; -using Xunit.Abstractions; using YamlDotNet.Samples.Helpers; using YamlDotNet.Serialization; @@ -92,33 +91,33 @@ public void Main() public class Address { public string street { get; set; } - public string city { get; set; } - public string state { get; set; } + public string city { get; set; } + public string state { get; set; } } public class Receipt { - public string receipt { get; set; } - public DateTime date { get; set; } - public Customer customer { get; set; } - public Item[] items { get; set; } - public Address bill_to { get; set; } - public Address ship_to { get; set; } - public string specialDelivery { get; set; } + public string receipt { get; set; } + public DateTime date { get; set; } + public Customer customer { get; set; } + public Item[] items { get; set; } + public Address bill_to { get; set; } + public Address ship_to { get; set; } + public string specialDelivery { get; set; } } public class Customer { - public string given { get; set; } + public string given { get; set; } public string family { get; set; } } public class Item { - public string part_no { get; set; } - public string descrip { get; set; } - public decimal price { get; set; } - public int quantity { get; set; } + public string part_no { get; set; } + public string descrip { get; set; } + public decimal price { get; set; } + public int quantity { get; set; } } #pragma warning restore IDE1006 // Naming Styles } diff --git a/YamlDotNet/Core/ParserExtensions.cs b/YamlDotNet/Core/ParserExtensions.cs index 40abc231e..d325d987f 100644 --- a/YamlDotNet/Core/ParserExtensions.cs +++ b/YamlDotNet/Core/ParserExtensions.cs @@ -51,7 +51,7 @@ public static T Consume(this IParser parser) where T : ParsingEvent /// /// Type of the . /// Returns true if the current event is of type T; otherwise returns null. - public static bool TryConsume(this IParser parser, [MaybeNullWhen(false)] out T @event) where T : ParsingEvent + public static bool TryConsume(this IParser parser, out T @event) where T : ParsingEvent { if (parser.Accept(out @event!)) { @@ -86,7 +86,7 @@ public static T Require(this IParser parser) where T : ParsingEvent /// /// Type of the event. /// Returns true if the current event is of type . Otherwise returns false. - public static bool Accept(this IParser parser, [MaybeNullWhen(false)] out T @event) where T : ParsingEvent + public static bool Accept(this IParser parser, out T @event) where T : ParsingEvent { if (parser.Current == null) { @@ -129,13 +129,13 @@ public static T Expect(this IParser parser) where T : ParsingEvent } [Obsolete("Please use TryConsume(out var evt) instead")] - public static T? Allow(this IParser parser) where T : ParsingEvent + public static T Allow(this IParser parser) where T : ParsingEvent { return parser.TryConsume(out var @event) ? @event : default; } [Obsolete("Please use Accept(out var evt) instead")] - public static T? Peek(this IParser parser) where T : ParsingEvent + public static T Peek(this IParser parser) where T : ParsingEvent { return parser.Accept(out var @event) ? @event : default; } diff --git a/YamlDotNet/Helpers/ExpressionExtensions.cs b/YamlDotNet/Helpers/ExpressionExtensions.cs index 19487bd23..9ef1fbfe5 100644 --- a/YamlDotNet/Helpers/ExpressionExtensions.cs +++ b/YamlDotNet/Helpers/ExpressionExtensions.cs @@ -47,7 +47,7 @@ public static PropertyInfo AsProperty(this LambdaExpression propertyAccessor) return property; } - private static TMemberInfo? TryGetMemberExpression(LambdaExpression lambdaExpression) + private static TMemberInfo TryGetMemberExpression(LambdaExpression lambdaExpression) where TMemberInfo : MemberInfo { if (lambdaExpression.Parameters.Count != 1) diff --git a/YamlDotNet/Helpers/OrderedDictionary.cs b/YamlDotNet/Helpers/OrderedDictionary.cs index cf602fbbb..bda747f3f 100644 --- a/YamlDotNet/Helpers/OrderedDictionary.cs +++ b/YamlDotNet/Helpers/OrderedDictionary.cs @@ -140,7 +140,7 @@ public void RemoveAt(int index) #pragma warning disable 8767 // Nullability of reference types in type of parameter ... doesn't match implicitly implemented member #endif - public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) => + public bool TryGetValue(TKey key, out TValue value) => dictionary.TryGetValue(key, out value); #if !(NETCOREAPP3_1) diff --git a/YamlDotNet/RepresentationModel/DocumentLoadingState.cs b/YamlDotNet/RepresentationModel/DocumentLoadingState.cs index e424c39be..3d41b80e0 100644 --- a/YamlDotNet/RepresentationModel/DocumentLoadingState.cs +++ b/YamlDotNet/RepresentationModel/DocumentLoadingState.cs @@ -81,7 +81,7 @@ public YamlNode GetNode(AnchorName anchor, Mark start, Mark end) /// The anchor. /// The node that was retrieved. /// true if the anchor was found; otherwise false. - public bool TryGetNode(AnchorName anchor, [NotNullWhen(true)] out YamlNode? node) + public bool TryGetNode(AnchorName anchor, out YamlNode? node) { return anchors.TryGetValue(anchor, out node); } diff --git a/YamlDotNet/RepresentationModel/YamlNodeIdentityEqualityComparer.cs b/YamlDotNet/RepresentationModel/YamlNodeIdentityEqualityComparer.cs index 383fe85f5..3a589e1d2 100644 --- a/YamlDotNet/RepresentationModel/YamlNodeIdentityEqualityComparer.cs +++ b/YamlDotNet/RepresentationModel/YamlNodeIdentityEqualityComparer.cs @@ -32,7 +32,7 @@ public sealed class YamlNodeIdentityEqualityComparer : IEqualityComparer Members /// - public bool Equals([AllowNull] YamlNode x, [AllowNull] YamlNode y) + public bool Equals(YamlNode x, YamlNode y) { return ReferenceEquals(x, y); } diff --git a/YamlDotNet/Serialization/ITypeInspector.cs b/YamlDotNet/Serialization/ITypeInspector.cs index ba914b3c0..a2be74df6 100644 --- a/YamlDotNet/Serialization/ITypeInspector.cs +++ b/YamlDotNet/Serialization/ITypeInspector.cs @@ -49,6 +49,6 @@ public interface ITypeInspector /// found in /// /// - IPropertyDescriptor GetProperty(Type type, object? container, string name, [MaybeNullWhen(true)] bool ignoreUnmatched); + IPropertyDescriptor GetProperty(Type type, object? container, string name, bool ignoreUnmatched); } } diff --git a/YamlDotNet/Serialization/TypeInspectors/TypeInspectorSkeleton.cs b/YamlDotNet/Serialization/TypeInspectors/TypeInspectorSkeleton.cs index d062d2cce..c0b69be8a 100644 --- a/YamlDotNet/Serialization/TypeInspectors/TypeInspectorSkeleton.cs +++ b/YamlDotNet/Serialization/TypeInspectors/TypeInspectorSkeleton.cs @@ -31,7 +31,7 @@ public abstract class TypeInspectorSkeleton : ITypeInspector { public abstract IEnumerable GetProperties(Type type, object? container); - public IPropertyDescriptor GetProperty(Type type, object? container, string name, [MaybeNullWhen(true)] bool ignoreUnmatched) + public IPropertyDescriptor GetProperty(Type type, object? container, string name, bool ignoreUnmatched) { var candidates = GetProperties(type, container) .Where(p => p.Name == name); diff --git a/YamlDotNet/Serialization/Utilities/ObjectAnchorCollection.cs b/YamlDotNet/Serialization/Utilities/ObjectAnchorCollection.cs index 708acbb40..f326ca837 100644 --- a/YamlDotNet/Serialization/Utilities/ObjectAnchorCollection.cs +++ b/YamlDotNet/Serialization/Utilities/ObjectAnchorCollection.cs @@ -50,7 +50,7 @@ public void Add(string anchor, object @object) /// The object. /// The anchor. /// - public bool TryGetAnchor(object @object, [MaybeNullWhen(false)] out string? anchor) + public bool TryGetAnchor(object @object, out string? anchor) { return anchorsByObject.TryGetValue(@object, out anchor); } diff --git a/YamlDotNet/Serialization/YamlAttributeOverrides.cs b/YamlDotNet/Serialization/YamlAttributeOverrides.cs index 14ed231da..11bc75f93 100644 --- a/YamlDotNet/Serialization/YamlAttributeOverrides.cs +++ b/YamlDotNet/Serialization/YamlAttributeOverrides.cs @@ -107,7 +107,7 @@ public int Matches(Type matchType) private readonly Dictionary> overrides = new Dictionary>(); - public T? GetAttribute(Type type, string member) where T : Attribute + public T GetAttribute(Type type, string member) where T : Attribute { if (overrides.TryGetValue(new AttributeKey(typeof(T), member), out var mappings)) {