Resharper重新排序具有依赖属性的成员

时间:2014-02-12 14:45:00

标签: c# formatting resharper

我创建了一个简单的自定义类型重新排序Xml模板。

除了具有依赖属性的View Models或CSLA Objects之外,它的效果非常好。

例如,我希望ViewModel看起来像这样:

public class ViewModel : DependencyObject
{
    #region Properties

    public static readonly DependencyProperty Property1Property = DependencyProperty.Register("Property1", typeof (string), typeof (ViewModel), new PropertyMetadata(default(string)));
    /// <summary>
    /// Gets or sets the property1.
    /// </summary>
    /// <value>
    /// The property1.
    /// </value>
    public string Property1
    {
        get { return (string) GetValue(Property1Property); }
        set { SetValue(Property1Property, value); }
    }

    #endregion
}

但在重新排序后它看起来像这样:

public class ViewModel : DependencyObject
{
    #region Constants

    public static readonly DependencyProperty Property1Property = DependencyProperty.Register("Property1", typeof (string), typeof (ViewModel), new PropertyMetadata(default(string)));

    #endregion

    #region Properties

    /// <summary>
    ///     Gets or sets the property1.
    /// </summary>
    /// <value>
    ///     The property1.
    /// </value>
    public string Property1
    {
        get { return (string) GetValue(Property1Property); }
        set { SetValue(Property1Property, value); }
    }

    #endregion
}

有没有办法将DependencyProperty声明和属性保持在一起?如果可能,我不想使用Resharper以外的工具。

0 个答案:

没有答案