Created
February 27, 2018 21:37
-
-
Save json2d/7053ae53035fbc94cf95a97da3f10563 to your computer and use it in GitHub Desktop.
C# Generics
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 T Func<T>(T a, T b){ | |
return new T(a + b); | |
} | |
public static void Main() { | |
print ("1 + 2 = " + Func (1, 2)); | |
print ("\"1\" + \"2\" = " + Func ("1", "2")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment