what is the reason /logic/obstacle behind the fact that partial methods can only have void return type?
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.
Partial methods are designed to be left out if you did not provide an implementation for them. The compiler actually removes calls to partial methods that are not implemented.
This also highlights why they cannot return anything: If you relied on a return value without implementing the partial method, then what? You’d have something uninitialised, despite the code clearly showing an assignment.
Similarly, methods that use the Conditional attribute can only return
voidfor the same reason. The method call may or may not exist in the compiled IL.