@@ -22,7 +22,7 @@ public static bool HasAttributes(this INode node)
2222 /// Try to get an attribute with the <paramref name="attributeName"/> from the <paramref name="node"/>.
2323 /// Returns true if the attribute exists, false otherwise.
2424 /// </summary>
25- public static bool TryGetAttr ( this INode node , string attributeName , [ NotNullWhen ( true ) ] out IAttr ? attribute )
25+ public static bool TryGetAttr ( this INode node , string attributeName , [ NotNullWhen ( true ) ] out IAttr ? attribute )
2626 {
2727 if ( node is IElement element && element . HasAttribute ( attributeName ) )
2828 {
@@ -52,7 +52,7 @@ public static bool TryGetAttrValue(this INode node, string attributeName, out bo
5252 /// Try to get an attribute value off of an element.
5353 /// Returns true when the attribute was found, false otherwise.
5454 /// </summary>
55- public static bool TryGetAttrValue ( this INode node , string attributeName , [ NotNullWhen ( true ) ] out string result )
55+ public static bool TryGetAttrValue ( this INode node , string attributeName , [ NotNullWhen ( true ) ] out string result )
5656 {
5757#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
5858 result = default ;
@@ -66,21 +66,21 @@ public static bool TryGetAttrValue(this INode node, string attributeName, [NotNu
6666 /// </summary>
6767 public static bool TryGetAttrValue < T > ( this INode node , string attributeName , out T result ) where T : System . Enum
6868 {
69- #pragma warning disable CS8653 // A default expression introduces a null value for a type parameter .
69+ #pragma warning disable CS8601 // Possible null reference assignment .
7070 result = default ;
71- #pragma warning restore CS8653 // A default expression introduces a null value for a type parameter .
71+ #pragma warning restore CS8601 // Possible null reference assignment .
7272 return node is IElement element && element . TryGetAttrValue ( attributeName , out result ) ;
7373 }
7474
7575 /// <summary>
7676 /// Try to get an attribute value off of an element.
7777 /// Returns true when the attribute was found, false otherwise.
7878 /// </summary>
79- public static bool TryGetAttrValue < T > ( this INode node , string attributeName , Func < string , T > resultFunc , [ NotNullWhen ( true ) ] out T result )
79+ public static bool TryGetAttrValue < T > ( this INode node , string attributeName , Func < string , T > resultFunc , [ NotNullWhen ( true ) ] out T result ) where T : notnull
8080 {
81- #pragma warning disable CS8653 // A default expression introduces a null value for a type parameter .
81+ #pragma warning disable CS8601 // Possible null reference assignment .
8282 result = default ;
83- #pragma warning restore CS8653 // A default expression introduces a null value for a type parameter .
83+ #pragma warning restore CS8601 // Possible null reference assignment .
8484 return node is IElement element && element . TryGetAttrValue ( attributeName , resultFunc , out result ) ;
8585 }
8686
0 commit comments