GenMethod = GenericMethod< myType >; MethodInfo method = this.GetType().GetMethod(GenMethod.Method.Name); MethodInfo generic = method.MakeGenericMethod(myType); generic.Invoke(this, null);, 4.Action<> GenMethod = GenericMethod< myType >; MethodInfo method = this.GetType().GetMethod("GenericMethod"); MethodInfo generic = method.MakeGenericMethod(myType); generic.Invoke(this, null);">
MCQs > IT & Programming > C# > Which of the following code snippets will call a generic method when the type parameter is not known at compile time?

C# MCQs

Which of the following code snippets will call a generic method when the type parameter is not known at compile time?

Answer

Correct Answer: MethodInfo method = typeof(Sample).GetMethod("GenericMethod"); MethodInfo generic = method.MakeGenericMethod(myType); generic.Invoke(this, null);

Explanation:

Note: This Question is unanswered, help us to find answer for this one

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

C# Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it