未验证 提交 f44e2e6d 编写于 作者: Z Zoltan Varga 提交者: GitHub

[mono] Fix the formatting of field types FieldInfo.ToString () so it matches clr. (#88648)

Fixes https://github.com/dotnet/runtime/issues/88637.
上级 e70f0dfc
......@@ -237,6 +237,7 @@
<Compile Include="System\Reflection\InvokeRefReturn.cs" />
<Compile Include="System\Reflection\InvokeWithRefLikeArgs.cs" />
<Compile Include="System\Reflection\IsCollectibleTests.cs" />
<Compile Include="System\Reflection\FieldInfoTests.cs" />
<Compile Include="System\Reflection\MethodBaseTests.cs" />
<Compile Include="System\Reflection\MethodBodyTests.cs" />
<Compile Include="System\Reflection\ModuleTests.cs" />
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using Xunit;
using TestAttributes;
namespace System.Reflection.Tests
{
public class FieldInfoTests
{
public int int_field;
[Fact]
public void ToStringFieldType()
{
Assert.Equal("Int32 int_field", typeof(FieldInfoTests).GetField("int_field").ToString());
}
}
}
......@@ -218,7 +218,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)
public override string ToString()
{
return $"{FieldType} {name}";
return $"{FieldType.FormatTypeName ()} {name}";
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册