TheHelpfulHelper
TheHelpfulHelper
CC#
Created by TheHelpfulHelper on 5/4/2024 in #help
✅ Conversions of types between two libraries
I suppose it is still the best solution, but seems rather unsatisfying
23 replies
CC#
Created by TheHelpfulHelper on 5/4/2024 in #help
✅ Conversions of types between two libraries
I just meant that two methods (back and forth) per common struct/class could potentially be a lot if you have a lot of them.
23 replies
CC#
Created by TheHelpfulHelper on 5/4/2024 in #help
✅ Conversions of types between two libraries
Is there really no better way? That would potentially be a lot of extension methods...
23 replies
CC#
Created by TheHelpfulHelper on 5/4/2024 in #help
✅ Conversions of types between two libraries
Dont ask me why these libraries thought they needed to create their own Vector structs, something something memory layout I think or I dont really know. All I know is that I need to use the libraries and I cant edit them.
23 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Huh seems to be a weird bug with copy and paste...if I manually write the exact same thing out it works.
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Uhh that doesnt compile for me
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Then the grouping would only have that key as the key of the grouping, but the actual elements could be objects
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
but I could also imagine needing a ConsecutiveGroupBy method, where the key is chosen from an object
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
I suppose for simple integers it does not make a lot of sense
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
So 1,2,3,4 would give you 4 groupings, but 1,2,2,3 would only give you 3, while 1,2,2,3,2 would give you 4 again
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Essentially it (as the name implies) groups all the elements which are consecutively equal in the list.
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Look at my example. My supposed "GroupConsecutive" method will give you a List which itself contains Groupings of all the consecutive elements in the given List.
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Yeah
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Or maybe a KeyValuePair<T, IReadOnlyList<T>>
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Would IGrouping be more appropiate?
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Yeah having multiple KVP is not good, since they all contain the same Key
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
I adjusted my example to better reflect a general solution
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Weird/Sad that there isnt a GroupConsecutive method :/
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
Yeah I suppose a manual foreach is the best then
78 replies
CC#
Created by TheHelpfulHelper on 2/21/2023 in #help
❔ LINQ: Group and extract all consecutive elements from List that match predicate
I was thinking about using GroupBy and somehow combining the value with its index, then working with that
78 replies