private ScriptUserdataField GetField(string strName)
        {
            if (m_FieldInfos.ContainsKey(strName))
            {
                return(m_FieldInfos[strName]);
            }
            ScriptUserdataField field = new ScriptUserdataField();

            field.name = strName;
            FieldInfo info = ValueType.GetField(strName);

            if (info != null)
            {
                field.field     = info;
                field.fieldType = info.FieldType;
                m_FieldInfos.Add(strName, field);
                return(field);
            }
            MethodInfo method = ValueType.GetMethod("get_" + strName);

            if (method != null)
            {
                field.getMethod = method;
                field.fieldType = method.ReturnType;
                field.setMethod = ValueType.GetMethod("set_" + strName);
                m_FieldInfos.Add(strName, field);
                return(field);
            }
            method = ValueType.GetMethod("set_" + strName);
            if (method != null)
            {
                field.setMethod = method;
                field.fieldType = method.GetParameters()[0].ParameterType;
                field.getMethod = ValueType.GetMethod("get_" + strName);
                m_FieldInfos.Add(strName, field);
                return(field);
            }
            return(null);
        }
 protected override Control CreateControl()
 {
     return(new ComboBox()
     {
         DropDownStyle = ComboBoxStyle.DropDownList, DisplayMember = "Value", ValueMember = "Key",
         DataSource = new BindingSource(Enum.GetValues(ValueType).Cast <object>().ToDictionary(v => v,
                                                                                               v => (GetCustomAttribute(ValueType.GetField(v.ToString()), typeof(DescriptionAttribute))
                                                                                                     as DescriptionAttribute ?? new DescriptionAttribute(v.ToString())).Description), null)
     });
 }