mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-21 17:13:09 +08:00
24 lines
682 B
C#
24 lines
682 B
C#
namespace System.Diagnostics
|
|
{
|
|
/// <summary>
|
|
/// 在调试器变量窗口中的显示方式
|
|
/// <para>https://docs.microsoft.com/zh-cn/dotnet/api/system.diagnostics.debuggerdisplayattribute?view=net-5.0</para>
|
|
/// </summary>
|
|
public interface IDebuggerDisplay
|
|
{
|
|
string GetDebuggerDisplayValue(object obj);
|
|
|
|
public static string GetValue(object obj)
|
|
{
|
|
try
|
|
{
|
|
var debuggerDisplay = DI.Get<IDebuggerDisplay>();
|
|
return debuggerDisplay.GetDebuggerDisplayValue(obj);
|
|
}
|
|
catch
|
|
{
|
|
return obj.ToString();
|
|
}
|
|
}
|
|
}
|
|
} |