generics in c#
class DataStore<T>
{
public T Data { get; set; }
}
generics in c#
class DataStore<T>
{
public T Data { get; set; }
}
generic method c#
//Swaps the lhs and rhs variables. T is a type given as an argument
//and can be used in the method like a type. (It doesn't have to be "T", it can
//be anything).
static void Swap<T>(ref T lhs, ref T rhs)
{
T temp;
temp = lhs;
lhs = rhs;
rhs = temp;
}
public static void TestSwap()
{
int a = 1;
int b = 2;
Swap<int>(ref a, ref b);
System.Console.WriteLine(a + " " + b);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us