Created
September 20, 2022 09:46
-
-
Save AntonC9018/453d818ad058cb7d4c9f673f72def2ea to your computer and use it in GitHub Desktop.
Overloading generics in C# proof of concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class A | |
{ | |
public static void a<T>(this T[] l, in T t) where T : struct | |
{ | |
} | |
} | |
public static class B | |
{ | |
public static void a<T>(this T[] l, T t) where T : class | |
{ | |
} | |
} | |
public static class C | |
{ | |
public static void Test() | |
{ | |
int[] l = { 1, 2, 3 }; | |
l.a(l[0]); | |
object[] k = { 1, 2, 3 }; | |
k.a(k[0]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment