Exemplo n.º 1
0
        private void WriteSignature(MethodSignature method, bool isForInterface = false)
        {
            var accessModifier = GetAccessModifier(method.Visibility);

            var asyncModifier = method.IsAsync ? "async " : "";

            var staticModifier = method.IsStatic ? "static " : "";

            var overrideModifier = method.IsOverriding ? "new " : "";

            var explicitName = method.DefiningInterface == null
                ? string.Empty
                : method.DefiningInterface + ".";

            if (explicitName != String.Empty) accessModifier = String.Empty;

            var genericParameters = method.GenericParameters == null
                ? string.Empty
                : "<" + String.Join(", ", method.GenericParameters) + ">";

            var template = isForInterface ? "{3}{4} {6}{7}({8});" : "{0}{1}{2}{3}{4} {5}{6}{7}({8})";

            WriteMethodDescription(method);
            _(template, accessModifier, asyncModifier, staticModifier, overrideModifier, method.ReturnType, explicitName, method.Name,
                genericParameters, method.Parameters.ToParametersString());
        }
Exemplo n.º 2
0
        private void WriteMethodDescription(MethodSignature method)
        {
            if (!string.IsNullOrEmpty(method.Description))
            {
                _builder.Write("/// <summary>");
                _builder.Write("/// " + method.Description);
                _builder.Write("/// </summary>");
            }

            if (method.Parameters != null)
            {
                var parameters = method.Parameters.Where(p => !string.IsNullOrEmpty(p.Description));
                foreach (var param in parameters)
                {
                    _builder.Write(string.Format("/// <param name=\"{0}\">", param.Name));
                    _builder.Write("/// " + param.Description);
                    _builder.Write("/// </param>");
                }
            }
        }