Use List<T> instead of ICollection in BehaviorDataObject#10278
Conversation
| @@ -1478,8 +1478,7 @@ protected override void OnDragEnter(DragEventArgs de) | |||
| object[] dragComps; | |||
There was a problem hiding this comment.
dragComps can now be IComponent[]
There was a problem hiding this comment.
It doesn't look that simple... OleDragDropHandler.GetDraggingObjects return an object[]. I think it can be refactored to return an IComponent[], but that's more involved. I'm not sure I should add it to this PR
There was a problem hiding this comment.
Looking at it again, it might be possible, but I'm not comfortable with making such a change. That would lead to assumptions that I'm not sure would hold all the time.
There was a problem hiding this comment.
Yeah, it depends if the team ever decided to implement another Component interface.
|
As apart of this change maybe refactor this? Something like: private Control ExtractControlFromDragEvent(DragEventArgs de) =>
(de.Data as DropSourceBehavior.BehaviorDataObject)?.DragComponents.FirstOrDefault() as Control; |
Nice catch, I hadn't noticed this one. |
|
I agree, follow up PR to make this change quicker to review. |
|
Finish work started in #8673
Related: #8140
Now that
DropSourceBehavioris passed aList<IComponent>in its constructor, we can updateBehaviorDataObjectto do the same instead of usingICollectionProposed changes
BehaviorDataObject.DragComponentsto be aList<IComponent>and update code accordinglyBehaviorDataObjectrefacto while we're touching this code, but in a separate commitMicrosoft Reviewers: Open in CodeFlow