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
//This is how you declare a class signature which uses a Generic Type | |
public class GenericList<Type> | |
{ | |
public void Add(Type input) | |
{ | |
//logic for adding to list.. | |
Console.WriteLine(input.ToString()); | |
} | |
} | |
} | |
public class GenericFields<Type> | |
{ | |
private Type _value; | |
public GenericFields(Type value) | |
{ | |
this._value = value; | |
} | |
// using properties | |
public Type value | |
{ | |
// using accessors | |
get | |
{ | |
return this._value; | |
} | |
set | |
{ | |
this._value = value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment