Skip to content

Commit

Permalink
Add missing NotNullIfNotNull attributes to operators
Browse files Browse the repository at this point in the history
  • Loading branch information
jozkee committed Aug 18, 2020
1 parent 9542f02 commit 43ba8e1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public static explicit operator bool(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="bool"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator bool?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -299,6 +300,7 @@ public static explicit operator int(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as an <see cref="int"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator int?(XAttribute attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -334,6 +336,7 @@ public static explicit operator uint(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as an <see cref="uint"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator uint?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -369,6 +372,7 @@ public static explicit operator long(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="long"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator long?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -404,6 +408,7 @@ public static explicit operator ulong(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as an <see cref="ulong"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator ulong?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -439,6 +444,7 @@ public static explicit operator float(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="float"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator float?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -474,6 +480,7 @@ public static explicit operator double(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="double"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator double?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -509,6 +516,7 @@ public static explicit operator decimal(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="decimal"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator decimal?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -544,6 +552,7 @@ public static explicit operator DateTime(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="DateTime"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator DateTime?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -579,6 +588,7 @@ public static explicit operator DateTimeOffset(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="DateTimeOffset"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator DateTimeOffset?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -614,6 +624,7 @@ public static explicit operator TimeSpan(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="TimeSpan"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator TimeSpan?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down Expand Up @@ -649,6 +660,7 @@ public static explicit operator Guid(XAttribute attribute)
/// The content of this <see cref="XAttribute"/> as a <see cref="Guid"/>?.
/// </returns>
[CLSCompliant(false)]
[return: NotNullIfNotNull("attribute")]
public static explicit operator Guid?(XAttribute? attribute)
{
if (attribute == null) return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,7 @@ public static explicit operator bool(XElement element)
/// Thrown if the element does not contain a valid boolean value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator bool?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1415,6 +1416,7 @@ public static explicit operator int(XElement element)
/// Thrown if the specified element does not contain a valid integer value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator int?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1456,6 +1458,7 @@ public static explicit operator uint(XElement element)
/// Thrown if the specified element does not contain a valid unsigned integer value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator uint?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1497,6 +1500,7 @@ public static explicit operator long(XElement element)
/// Thrown if the specified element does not contain a valid long integer value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator long?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1538,6 +1542,7 @@ public static explicit operator ulong(XElement element)
/// Thrown if the specified element does not contain a valid unsigned long integer value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator ulong?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1579,6 +1584,7 @@ public static explicit operator float(XElement element)
/// Thrown if the specified element does not contain a valid float value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator float?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1620,6 +1626,7 @@ public static explicit operator double(XElement element)
/// Thrown if the specified element does not contain a valid double value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator double?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1661,6 +1668,7 @@ public static explicit operator decimal(XElement element)
/// Thrown if the specified element does not contain a valid decimal value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator decimal?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1702,6 +1710,7 @@ public static explicit operator DateTime(XElement element)
/// Thrown if the specified element does not contain a valid <see cref="DateTime"/> value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator DateTime?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1743,6 +1752,7 @@ public static explicit operator DateTimeOffset(XElement element)
/// Thrown if the specified element does not contain a valid <see cref="DateTimeOffset"/> value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator DateTimeOffset?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1784,6 +1794,7 @@ public static explicit operator TimeSpan(XElement element)
/// Thrown if the specified element does not contain a valid <see cref="TimeSpan"/> value.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator TimeSpan?(XElement? element)
{
if (element == null) return null;
Expand Down Expand Up @@ -1825,6 +1836,7 @@ public static explicit operator Guid(XElement element)
/// Thrown if the specified element does not contain a valid guid.
/// </exception>
[CLSCompliant(false)]
[return: NotNullIfNotNull("element")]
public static explicit operator Guid?(XElement? element)
{
if (element == null) return null;
Expand Down

0 comments on commit 43ba8e1

Please sign in to comment.