コード例 #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ConstructorInfo c           = value as ConstructorInfo;
            string          nameGenArgs = TypenameBuilder.BuildTypename(c.DeclaringType.Name, c.DeclaringType.GetGenericArguments(), true);

            string parameters = '(' + string.Join(",", c.GetParameters().Select(p => TypenameBuilder.BuildTypename(p.ParameterType.Name, p.ParameterType.GetGenericArguments(), true) + ' ' + p.Name)) + ')';

            return(nameGenArgs + parameters);
        }
コード例 #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string typeName  = (value as FieldInfo)?.FieldType.Name ?? (value as PropertyInfo)?.PropertyType.Name;
            string fieldName = (value as FieldInfo)?.Name ?? (value as PropertyInfo)?.Name;

            Type[] genArguments = (value as 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)
        {
            MethodInfo m = value as MethodInfo;

            string typeNameGenArgs = TypenameBuilder.BuildTypename(m.Info.ReturnType.Name, m.Info.ReturnType.GetGenericArguments(), true);
            string nameGenArgs     = TypenameBuilder.BuildTypename(m.Info.Name, m.Info.GetGenericArguments(), false);
            string parameters      = '(' + string.Join(",", m.Info.GetParameters().Select(p => TypenameBuilder.BuildTypename(p.ParameterType.Name, p.ParameterType.GetGenericArguments(), true) + ' ' + p.Name)) + ')';
            string ext             = m.IsExtension ? "(extension) " : null;

            return(ext + typeNameGenArgs + ' ' + nameGenArgs + parameters);
        }
コード例 #4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ClassInfo c = value as ClassInfo;

            return(TypenameBuilder.BuildTypename(c.ClassType.Name, c.ClassType.GetGenericArguments(), true));
        }