public static string CSharpName(this MemberInfo member, MemberAction action) { if (member is MethodInfo && ((MethodInfo)member).IsOperator()) { return(OperatorUtility.operatorAlternativeNames[member.Name]); } if (member is ConstructorInfo) { return("new " + member.DeclaringType.CSharpName()); } var memberName = member.Name; if (member is PropertyInfo propertyInfo && propertyInfo.IsIndexer()) { memberName = "[]"; } if ((member is FieldInfo || member is PropertyInfo) && action != MemberAction.None) { return($"{memberName} ({action.ToString().ToLower()})"); } return(memberName); }
public static string Verb(this MemberAction action) { return(action.ToString()); }