コード例 #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var classInfo = value as ClassInfo;

            return(TypenameBuilder.BuildTypename(classInfo.ClassType.Name, classInfo.ClassType.GetGenericArguments(),
                                                 true));
        }
コード例 #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var fieldInfo    = value as FieldInfo;
            var typeName     = fieldInfo?.FieldType.Name ?? (value as PropertyInfo)?.PropertyType.Name;
            var fieldName    = fieldInfo?.Name ?? (value as PropertyInfo)?.Name;
            var genArguments = fieldInfo?.FieldType.GetGenericArguments() ??
                               (value as PropertyInfo)?.PropertyType.GetGenericArguments();

            return(TypenameBuilder.BuildTypename(typeName, genArguments, true) + ' ' + fieldName);
        }
コード例 #3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var constructorInfo = value as ConstructorInfo;
            var nameGenArgs     = TypenameBuilder.BuildTypename(constructorInfo.DeclaringType.Name,
                                                                constructorInfo.DeclaringType.GetGenericArguments(), true);
            var parameters = '(' + string.Join(",",
                                               constructorInfo.GetParameters().Select(p =>
                                                                                      TypenameBuilder.BuildTypename(p.ParameterType.Name, p.ParameterType.GetGenericArguments(), true) +
                                                                                      ' ' + p.Name)) + ')';

            return(nameGenArgs + parameters);
        }
コード例 #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var methodInfo      = value as MethodInfo;
            var typeNameGenArgs = TypenameBuilder.BuildTypename(methodInfo.Info.ReturnType.Name,
                                                                methodInfo.Info.ReturnType.GetGenericArguments(), true);
            var nameGenArgs =
                TypenameBuilder.BuildTypename(methodInfo.Info.Name, methodInfo.Info.GetGenericArguments(), false);
            var parameters = '(' + string.Join(",",
                                               methodInfo.Info.GetParameters().Select(p =>
                                                                                      TypenameBuilder.BuildTypename(p.ParameterType.Name, p.ParameterType.GetGenericArguments(), true) +
                                                                                      ' ' + p.Name)) + ')';
            var ext = methodInfo.IsExtension ? "(extension) " : null;

            return(ext + typeNameGenArgs + ' ' + nameGenArgs + parameters);
        }