C
Chris Capel
I want to do something along the lines of this:
class someclass {
static void Main() {
int i = 5;
int j = 3;
changevalue(ref i, j);
Console.WriteLine(i.ToString()); //I want this to output 3
}
//it's important that this parameter is an object, and not an int or
something
static void changevalue(ref object i, object j) {
i = j
}
}
I'd like this to work for any type, not just ints. Is there any way to
accomplish something like this?
Chris
class someclass {
static void Main() {
int i = 5;
int j = 3;
changevalue(ref i, j);
Console.WriteLine(i.ToString()); //I want this to output 3
}
//it's important that this parameter is an object, and not an int or
something
static void changevalue(ref object i, object j) {
i = j
}
}
I'd like this to work for any type, not just ints. Is there any way to
accomplish something like this?
Chris