Last active
March 23, 2019 03:44
-
-
Save nodlAndHodl/ee5ccf1171106cea4bf2a2f2283a77ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class GenericClass<T> where T : class | |
| { | |
| private T _genericField; | |
| public T genericProperty { get; set; } | |
| public GenericClass(T value) | |
| { | |
| _genericField = value; | |
| } | |
| public T genericMethod(T genericParameter) | |
| { | |
| this.genericProperty = genericParameter; | |
| Console.WriteLine("Parameter type: {0}, value: {1}", typeof(T).ToString(), genericParameter); | |
| Console.WriteLine("Return type: {0}, value: {1}", typeof(T).ToString(), this._genericField); | |
| return this._genericField; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment