 悬赏园豆:20
                [已解决问题] 
            
                    解决于 2019-10-17 17:02
                悬赏园豆:20
                [已解决问题] 
            
                    解决于 2019-10-17 17:02 
                 
        RoutedCommand 位于 System.Windows.Input 命名空间下,唯一继承自 ICommand,
其构造方法为
  /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Input.RoutedCommand" /> class.</summary>
    public RoutedCommand()
    {
      this._name = string.Empty;
      this._ownerType = (Type) null;
      this._inputGestureCollection = (InputGestureCollection) null;
    }
    /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Input.RoutedCommand" /> class with the specified name and owner type.</summary>
    /// <param name="name">Declared name for serialization.</param>
    /// <param name="ownerType">The type which is registering the command.</param>
    /// <exception cref="T:System.ArgumentNullException">
    /// <paramref name="name" /> is <see langword="null" />.</exception>
    /// <exception cref="T:System.ArgumentException">the length of <paramref name="name" /> is zero.</exception>
    /// <exception cref="T:System.ArgumentException">
    /// <paramref name="ownerType" /> is <see langword="null" />.</exception>
    public RoutedCommand(string name, Type ownerType)
      : this(name, ownerType, (InputGestureCollection) null)
    {
    }this._inputGestureCollection = (InputGestureCollection) null;
为什么 赋值 null 还需要给它强制转换成 InputGestrueCollection 类型呢? 避免装拆箱,影响性能?
 #region Constructors
        /// <summary>
        ///     Default Constructor - needed to allow markup creation
        /// </summary>
        public RoutedCommand()
        {
            _name = String.Empty;
            _ownerType = null;
            _inputGestureCollection = null;
        }
        /// <summary>
        /// RoutedCommand Constructor with Name and OwnerType
        /// </summary>
        /// <param name="name">Declared Name of the RoutedCommand for Serialization</param>
        /// <param name="ownerType">Type that is registering the property</param>
        public RoutedCommand(string name, Type ownerType) : this(name, ownerType, null)
        {
        }
        /// <summary>
        /// RoutedCommand Constructor with Name and OwnerType
        /// </summary>
        /// <param name="name">Declared Name of the RoutedCommand for Serialization</param>
        /// <param name="ownerType">Type that is registering the property</param>
        /// <param name="inputGestures">Default Input Gestures associated</param>
        public RoutedCommand(string name, Type ownerType, InputGestureCollection inputGestures)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name.Length == 0)
            {
                throw new ArgumentException(SR.Get(SRID.StringEmpty), "name");
            }
            if (ownerType == null)
            {
                throw new ArgumentNullException("ownerType");
            }
            _name = name;
            _ownerType = ownerType;
            _inputGestureCollection = inputGestures;
        }
        /// <summary>
        /// RoutedCommand Constructor with Name and OwnerType and command identifier.
        /// </summary>
        /// <param name="name">Declared Name of the RoutedCommand for Serialization</param>
        /// <param name="ownerType">Type that is registering the property</param>
        /// <param name="commandId">Byte identifier for the command assigned by the owning type</param>
        internal RoutedCommand(string name, Type ownerType, byte commandId) : this(name, ownerType, null)
        {
            _commandId = commandId;
        }
        #endregion我这边.NET4.8源码显示和你的不一样啊
应该是 Resharper 自己反编译后处理过的,不是源码的问题。O(∩_∩)O哈哈~
@BUTTERAPPLE: 应该是的