Hi i have to call a method that has this signature:
int MethodName(ref object vIndexKey)
If i try to call it with
String c = "690";
MethodName(ref (object) c);
It doesn’t work.
How can i do?
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to do it like this:
The reason is that the parameter must be assignable by the function. The function could do something like this:
Which is not possible if the underlying type is a string that has been casted to an object during the method call, because the target of the assignment would still be a string and not an object.