Ejemplo n.º 1
0
        public static void LogClrTypeInfo(this ClrType clrType, ILogger logger)
        {
            var propertyQuery =
                from property in clrType.GetType()
                .GetProperties()
                where property.CanRead && !property.IsSpecialName
                select new { propName = property.Name, propValue = property.GetValue(clrType) };

            foreach (var property in propertyQuery)
            {
                logger.LogInformation($"{property.propName}: {property.propValue}");
            }

            //            foreach (var clrMethod in clrType.Methods)
            //            {
            //                PrintIndention(indention);
            //                logger.LogInformation(clrMethod.Name);
            //            }

            //            PrintIndention(indention);
            //            logger.LogInformation($"Fields.Count: {clrType.Fields.Count}");
            //
            //            PrintIndention(indention);
            //            logger.LogInformation($"StaticFields.Count: {clrType.StaticFields.Count}");
            //
            //            PrintIndention(indention);
            //            logger.LogInformation($"ThreadStaticFields.Count: {clrType.ThreadStaticFields.Count}");
            //
            //            PrintIndention(indention);
            //            logger.LogInformation($"Methods.Count: {clrType.Methods.Count}");
            //
            //            PrintIndention(indention);

            foreach (var clrInterface in clrType.EnumerateInterfaces())
            {
                logger.LogInformation(clrInterface.Name);
            }

            logger.LogInformation($"Interfaces.Count: {clrType.EnumerateInterfaces().Count()}");

            //            clrType.
        }