Skip to content

Instantly share code, notes, and snippets.

Last active March 23, 2019 03:44
What would you like to do?
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