Exemplo n.º 1
0
        internal static ICodeWriter DoAppendSignature(
            this ICodeWriter @this,
            AccessProtectionOption protection,
            string frontModifier,
            MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }
            string name = method.Name;

            if (method.ContainsGenericParameters)
            {
                name += '<';
                name += String.Join(",", method.GetGenericArguments().Select(a => a.Name));
                name += '>';
            }
            if (protection != AccessProtectionOption.None)
            {
                @this.AppendAccessProtection(method, protection);
            }
            @this.Append(frontModifier)
            .AppendCSharpName(method.ReturnType, true, true, useValueTupleParentheses: true)
            .Space()
            .Append(name)
            .AppendParameters(method.GetParameters());
            return(@this);
        }