I want to use the following method.
private void LocationChange(Object obj, int first, int second)
{
// so then if i say
obj.Location = new Point(first,second);
}
but this won’t work for me is there a way around this?
Thanks for the help
Since
Locationis a property ofControl, you ought to make the parameter of that type:You can then pass any type that subclasses
Controlinto that method.I’m not sure why you would allow any
objectto be passed into the method if it’s meant to operate on a Control specifically, but if you had some other, non-control-specific logic in there, you could cast the parameter, like so: