Output: Prepend fields, events, properties and parameter names using reserved C# keywords with @

This commit is contained in:
Katy Coe
2019-12-12 10:18:55 +01:00
parent f10d52bdd2
commit f60047a55a
6 changed files with 53 additions and 5 deletions

View File

@@ -29,6 +29,9 @@ namespace Il2CppInspector.Reflection {
// Name of the member
public virtual string Name { get; protected set; }
// Name of the member with @ prepended if the name is a C# reserved keyword
public string CSharpSafeName => Constants.Keywords.Contains(Name) ? "@" + Name : Name;
// For top-level members in an assembly (ie. non-nested types)
protected MemberInfo(Assembly asm) => Assembly = asm;