Exemple #1
0
        public object Convert(object obj, Type type, object param, CultureInfo culture)
        {
            Type   typeInfo = (Type)obj;
            string result   = "";

            if (typeInfo.IsPublic)
            {
                result += "public ";
            }
            else
            {
                result += "private ";
            }
            if (typeInfo.IsAbstract)
            {
                result += "abstract ";
            }
            if (typeInfo.IsSealed)
            {
                result += "sealed ";
            }
            if (typeInfo.IsClass)
            {
                result += "class ";
            }
            if (typeInfo.IsInterface)
            {
                result += "interface ";
            }
            result += ConvertNames.GetTypeName(type);
            return(result);
        }
Exemple #2
0
        public object Convert(object obj, Type targetType, object param, CultureInfo culture)
        {
            string       result       = "";
            PropertyInfo propertyInfo = (PropertyInfo)obj;

            result += ConvertNames.GetTypeName(propertyInfo.PropertyType) + " " + propertyInfo.Name;
            return(result);
        }
Exemple #3
0
        public object Convert(object obj, Type targetType, object param, CultureInfo culture)
        {
            string    result    = "";
            FieldInfo fieldInfo = (FieldInfo)obj;

            if (fieldInfo.IsPublic)
            {
                result += "public ";
            }
            else
            {
                result += "private ";
            }
            if (fieldInfo.IsStatic)
            {
                result += "static ";
            }
            result += ConvertNames.GetTypeName(fieldInfo.FieldType) + " " + fieldInfo.Name;
            return(result);
        }
Exemple #4
0
        public object Convert(object obj, Type targetType, object param, CultureInfo culture)
        {
            MethodInfo methodInfo = (MethodInfo)obj;
            string     result     = "";

            if (methodInfo.IsPublic)
            {
                result += "public ";
            }
            else
            {
                result += "private ";
            }

            if (methodInfo.IsStatic)
            {
                result += "static ";
            }
            if (methodInfo.IsAbstract)
            {
                result += "abstract ";
            }
            if (methodInfo.IsVirtual)
            {
                result += "virtual ";
            }
            result += ConvertNames.GetTypeName(methodInfo.ReturnType) + " " + methodInfo.Name;
            result += "(";
            ParameterInfo[] parameters = methodInfo.GetParameters();
            foreach (ParameterInfo parameter in parameters)
            {
                result += ConvertNames.GetTypeName(parameter.ParameterType) + " " + parameter.Name + ",";
            }
            if (parameters.Length > 0)
            {
                result = result.Remove(result.LastIndexOf(","));
            }
            result += ")";
            return(result);
        }