Exemple #1
0
        string GetLanguageSpecificName(Language language, IMemberDefinition member, bool fullName = false)
        {
            switch (member)
            {
            case TypeDefinition t:
                return(language.TypeToString(t, fullName));

            case FieldDefinition f:
                return(fullName ? language.TypeToString(f.DeclaringType, fullName) + "." + language.FormatFieldName(f) : language.FormatFieldName(f));

            case PropertyDefinition p:
                return(fullName ? language.TypeToString(p.DeclaringType, fullName) + "." + language.FormatPropertyName(p) : language.FormatPropertyName(p));

            case MethodDefinition m:
                return(fullName ? language.TypeToString(m.DeclaringType, fullName) + "." + language.FormatMethodName(m) : language.FormatMethodName(m));

            case EventDefinition e:
                return(fullName ? language.TypeToString(e.DeclaringType, fullName) + "." + language.FormatEventName(e) : language.FormatEventName(e));

            default:
                throw new NotSupportedException(member?.GetType() + " not supported!");
            }
        }