EditorAttribute的别名 [英] Alias for EditorAttribute

查看:65
本文介绍了EditorAttribute的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为EditorAttribute创建较短的别名?代替:

Is there a way to create a shorter alias for an EditorAttribute? Instead of:

    [EditorAttribute(typeof<ColorPickerDialogPropertyValueEditor>, typeof<DialogPropertyValueEditor>)]
    public Color4 Color { get; set; }

我想写:

    using ColorPicker = EditorAttribute(typeof<ColorPickerDialogPropertyValueEditor>, typeof<DialogPropertyValueEditor>)
    [ColorPicker]
    public Color4 Color { get; set; }

不幸的是,EditorAttribute类是密封的,因此我无法继承它.

Unfortunately the EditorAttribute class is sealed so I cannot inherit it.

推荐答案

我只看到一种方法:

using CPDPEditor = YourNamespace.ColorPickerDialogPropertyValueEditor;
using DPEditor = YourNamespace.DialogPropertyValueEditor;

...

[Editor(typeof(CPDPEditor), typeof(DPEditor))]

或者AttributeProvider可能会帮助您(不知道如何做)

Or maybe the AttributeProvider will help you (dont know how)

这篇关于EditorAttribute的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆