Does anybody know if it’s possible to call method on CLR object via indexer using dynamic lang features? For instance, myClrObj["SuperMethod"] () which I can easily do in javascript.
thank in advance.
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.
There may be better ways, but one way I’d know how to do it is:
DynamicObjectProvide an extension method that suitably makes your object appear dynamic, with the correct DynamicObject specialization instantiated.
dynamic obj = myObj.AsIndexedObj(); obj["Do"]();