Skip to content

Commit

Permalink
Fix nullability of TypeNameHelper.GetTypeDisplayName parameter (#30987)
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang authored Mar 17, 2021
1 parent 54d04c5 commit 688b7de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Shared/TypeNameHelper/TypeNameHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

#nullable enable

Expand Down Expand Up @@ -33,7 +34,8 @@ internal static class TypeNameHelper
{ typeof(ushort), "ushort" }
};

public static string? GetTypeDisplayName(object item, bool fullName = true)
[return: NotNullIfNotNull("item")]
public static string? GetTypeDisplayName(object? item, bool fullName = true)
{
return item == null ? null : GetTypeDisplayName(item.GetType(), fullName);
}
Expand Down

0 comments on commit 688b7de

Please sign in to comment.