SirCarter
SirCarter
CC#
Created by SirCarter on 5/31/2023 in #help
❔ Covariant Interface Return
Sad but that makes sense
13 replies
CC#
Created by SirCarter on 5/31/2023 in #help
❔ Covariant Interface Return
I'm not sure I'm understanding why they can't do the same things with an interface, if I cass FooBarGetter to IFooReturner, I'd still get a Foo from GetFoo
13 replies
CC#
Created by SirCarter on 5/31/2023 in #help
❔ Covariant Interface Return
So something like this works, we can override the return type and it still works because FooBar is a Foo, it still matches the contract of the original class but with more specificity
13 replies
CC#
Created by SirCarter on 5/31/2023 in #help
❔ Covariant Interface Return
class FooReturner { virtual Foo GetFoo(); }
class Foo {}
class FooBar : Foo {}
class FooBarGetter : FooReturner { override FooBar GetFoo(); }
class FooReturner { virtual Foo GetFoo(); }
class Foo {}
class FooBar : Foo {}
class FooBarGetter : FooReturner { override FooBar GetFoo(); }
13 replies
CC#
Created by SirCarter on 5/31/2023 in #help
❔ Covariant Interface Return
It kinda does though
13 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
I think that does what I want at least
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
For anyone coming later, adding a nullable property getter reads fairly nicely: foo is {Left: {} left}
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
Praying for real unions one day
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
Thanks though!
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
I wanted something a bit prettier 😭
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
Yeah I was trying to avoid something like that since but that's gonna be my default
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
Or assignable to, but I guess that doesn't include the conversions
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
Damn
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
Yes, and that works for assignment operations
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
Just get is to use an implicit operator from Either<T1, T2> to T1
28 replies
CC#
Created by SirCarter on 4/26/2023 in #help
❔ User-defined implicit type conversion + type pattern match
Not override is
28 replies