Skip to content

Instantly share code, notes, and snippets.

@nodlAndHodl
Created February 15, 2019 20:05
Show Gist options
  • Select an option

  • Save nodlAndHodl/26d4fa75db7a998659c26fe3e68d7ad3 to your computer and use it in GitHub Desktop.

Select an option

Save nodlAndHodl/26d4fa75db7a998659c26fe3e68d7ad3 to your computer and use it in GitHub Desktop.
//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