Timeline for Order of interface used for GetComponent
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 9, 2022 at 21:55 | comment | added | DMGregory♦ | I'd say your Test 5 version is worth posting as an answer, then. There's not much getting around that cast - you could write it differently using LINQ, but it would still be there. | |
| Oct 9, 2022 at 21:51 | answer | added | Filip Milovanović | timeline score: 0 | |
| Oct 9, 2022 at 21:24 | comment | added | Zibelas | Yes, using the the cast to type solves the GetComponents part. Is there a reverse option to not need to use baseValue = ((IBaseMod) mod).ApplyModifier(baseValue); the IBaseMod but the corresponding interface? As it is this is still the best solution since the interface is only used as a helper but if there is something added in the future | |
| Oct 9, 2022 at 21:21 | history | edited | Zibelas | CC BY-SA 4.0 | added 732 characters in body |
| Oct 9, 2022 at 20:46 | comment | added | DMGregory♦ | Did you try writing a version of Test 3 with System.Type[] and the GetComponent(Type type) overload? | |
| Oct 9, 2022 at 20:40 | history | edited | Zibelas | CC BY-SA 4.0 | added 228 characters in body |
| Oct 9, 2022 at 20:00 | history | edited | Zibelas | CC BY-SA 4.0 | added 1154 characters in body |
| Oct 9, 2022 at 17:40 | history | edited | Pikalek | CC BY-SA 4.0 | added markdown to code in text, added relevant tag |
| Oct 9, 2022 at 17:38 | history | asked | Zibelas | CC BY-SA 4.0 |