Hi!
I wonder if there is something in C# like C++ templates from STL.
With a template you could do a swap function that could swap any two variables no matter what type they are, so long that they are the same type.
Template T<something don’t remember>
void swap(T &y, T &x)
{
T temp;
temp = x;
x = y;
y = temp;
}
int a, b;
double c, d;
bool e, f;
swap(a, b);
swap(c, d);
swap(e, f);
Can this be done in C#?
Larsson
I wonder if there is something in C# like C++ templates from STL.
With a template you could do a swap function that could swap any two variables no matter what type they are, so long that they are the same type.
Template T<something don’t remember>
void swap(T &y, T &x)
{
T temp;
temp = x;
x = y;
y = temp;
}
int a, b;
double c, d;
bool e, f;
swap(a, b);
swap(c, d);
swap(e, f);
Can this be done in C#?
Larsson