-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Moved to generics #2866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Moved to generics #2866
Conversation
For context on if I were to make this real I would just change the existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm no against it if there are no regression.
I don't think we can do a transition with an duplicated obsolete and non-obsolete property. That would be messy. So it has to be a breaking change IMO.
sources/core/Stride.Core/Collections/TrackingCollectionChangedEventArgs.cs
Outdated
Show resolved
Hide resolved
Im ok with it being a breaking change. I think it would be fairly easy to tell people how to migrate as they just need to define their types but I just dont want to wait for this to release 😆 I was also thinking of making a seperate event args for Lists since they shouldnt need to define 2 types and would simplify the |
I went ahead with the implementation that separates the definition between collections and keyed collections. This was a lot nicer to work with at a higher level and just looked cleaner overall. Would this be able to be pushed in to main as a revision breaking change or would it have to wait for the major/minor release? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just minor stuff. Have you looked at the samples solution if there is any remnant over there as well ?
// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) | ||
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like your IDE ate the header
private EventHandler<TrackingCollectionChangedEventArgs<T>>? _itemAdded; | ||
private EventHandler<TrackingCollectionChangedEventArgs<T>>? _itemRemoved; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong naming convention
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my mistake, I thought we were going to use the Microsoft standards for new changes if we worked in them. Ill switch them back to the lower camel case structure.
// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) | ||
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to worry that you aren't feeding your IDE correctly
private EventHandler<TrackingKeyedCollectionChangedEventArgs<TKey, TValue>>? _itemAdded; | ||
private EventHandler<TrackingKeyedCollectionChangedEventArgs<TKey, TValue>>? _itemRemoved; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, same here
private EventHandler<TrackingCollectionChangedEventArgs<T>>? _itemAdded; | ||
private EventHandler<TrackingCollectionChangedEventArgs<T>>? _itemRemoved; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup
I'll change this to draft for organizational purposes, feel free to change it back when ready :) |
PR Details
This PR shows a POC that would reduce the amount of required casts by users. I don't want to merge this but I was curious on what the thoughts would be on something like this as using object causes a ton of casting and required checks to be usable. Ideally I would redo this PR but with the
Obsolete
attribute. The only variable that gets in the way isCollectionChanged
as I dont know what the non-obsolete variable would be called.I also still need to verify that there wont be weird checks in the GameStudio layers as I assume they may not like generics as much as objects.Works fine.Related Issue
No related issues. I ran into this today trying to use tracking collections for a modular system I am experimenting with as seen in the code snippet below:
Types of changes
Checklist