Exemple #1
0
        private XElement GetInfoMethod(MethodTrace methodInfo)
        {
            var result = new XElement("method");

            result.Add(new XAttribute("name", methodInfo.Metadata.Name));
            result.Add(new XAttribute("time", methodInfo.GetExecutionTime()));
            result.Add(new XAttribute("class", methodInfo.Metadata.ClassName));
            result.Add(new XAttribute("params", methodInfo.Metadata.CountParameters));
            return(result);
        }
        private void WriteMethodInfo(MethodTrace methodInfo, int nestingLevel = 0)
        {
            var nesting = new string('\t', nestingLevel);

            Console.WriteLine($"{nesting}Method name: {methodInfo.Metadata.Name}; time: {methodInfo.GetExecutionTime()}; " +
                              $" class: {methodInfo.Metadata.ClassName}; params: {methodInfo.Metadata.CountParameters}");

            foreach (var nestedMethod in methodInfo.NestedMethods)
            {
                WriteMethodInfo(nestedMethod, nestingLevel + 1);
            }
        }