Use nameof instead of hardcoded strings in reflection calls.

This helps improve the safety of code the uses reflection when methods may get renamed, and helps navigating code as the nameof will show up when searching for references to members.
This commit is contained in:
RoosterDragon
2022-04-04 16:08:55 +01:00
committed by abcdefg30
parent b254eb0f3d
commit ac0969d688
8 changed files with 9 additions and 9 deletions

View File

@@ -238,7 +238,7 @@ namespace OpenRA.Network
{
// The lambda generated is shown below.
// TSync is actual type of the ISync object. Foo is a field or property with the Sync attribute applied.
var toString = memberType.GetMethod("ToString", Type.EmptyTypes);
var toString = memberType.GetMethod(nameof(object.ToString), Type.EmptyTypes);
Expression getString;
if (memberType.IsValueType)
{