What I want to do is, I want to pass a pointer to a function that may be any type of a variable(int, long, string, even a class I mean I should be able to pass any variable's pointer). I'm doing this like that
unsafe class whatever
{
whatever(object* variable)
{
this.variable = variable;
}
}
ERROR IS: Cannot take the address of, get the size of, or declare a pointer to a managed type ('object')
Why I want to do is, I will store the variables passed through the constructor and will use their ToString() method, I'm trying to make a class that is for console applications, Refreshing the variables with their updated variables.
If I could do it like that My code will look like that
unsafe class whatever
{
whatever(object* variable)
{
this.variable = variable;
}
object* variable;
public override string ToString()
{
return *variable.ToString();
}
}