Description:Microsoft .NET Framework 2.0-Application Development Foundation
Passing Score:75%
Practice Test - Number of questions:203 questions
Simulation Test - Number of questions:203 questions
Simulation Test Duration:90 minutes
Has explanations:No
Question of the day
You write the following code to implement the CompanyClass.MyMethod function.
public class CompanyClass {
public int MyMethod(int arg) {
return arg;
}}
You need to call the CompanyClass.MyMethod function dynamically from an unrelated class in
your assembly. Which code segment should you use?
Answer(s)
MyClass^ myClass = gcnew MyClass();Type^ t = MyClass::typeid;MethodInfo^ m = t->GetMethod("MyMethod");int i =(int)m->Invoke(this, gcnew array
MyClass^ myClass = gcnew MyClass();Type^ t = MyClass::typeid;MethodInfo^ m = t->GetMethod("MyMethod");int i =(int)m->Invoke(myClass, gcnew array
MyClass^ myClass = gcnew MyClass();Type^ t = MyClass::typeid;MethodInfo^ m = t->GetMethod("MyClass.MyMethod");int i =(int)m->Invoke(myClass, gcnew array
Type^ t = Type::GetType("MyClass");MethodInfo^ m = t->GetMethod("MyMethod");int i =(int)m->Invoke(this, gcnew array
Correct Answer
MyClass^ myClass = gcnew MyClass();Type^ t = MyClass::typeid;MethodInfo^ m = t->GetMethod("MyMethod");int i =(int)m->Invoke(myClass, gcnew array