---
title: "How to call reflection method"  
description: "How to call reflection method"  
author: "Anonymous User"  
published: 2014-02-09  
updated: 2014-02-09  
canonical: https://www.mindstick.com/forum/1969/how-to-call-reflection-method  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to call reflection method

Is there an easier way to call [reflection](https://www.mindstick.com/articles/13004/how-to-write-a-reflection-paper) [method instead](https://www.mindstick.com/interview/2492/can-we-call-the-run-method-instead-of-start) of create methodInfo and object [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) as per below?

[Assembly](https://www.mindstick.com/articles/25/global-assembly-cache) [asm](https://answers.mindstick.com/qa/104847/explain-oracle-automatic-storage-management-asm) = Assembly.Load("[Test](https://yourviews.mindstick.com/story/1427/explosive-facts-about-trinity-test-world-s-first-nuclear-bomb)");

Type t= asm.GetType("test.myclass");

object obj = Activator.CreateInstance(t);

MethodInfo mi = t.GetMethod("foo");

object[] args = { 10, 70 };

Console.WriteLine("[output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular) {0}", mi.Invoke(obj, args));

## Replies

### Reply by Pravesh Singh

Hi Ben,

Use dynamic keyword:

Assembly asm = Assembly.Load("Test");

Type t = asm.GetType("test.myclass");

dynamic obj = Activator.CreateInstance(t);

Console.WriteLine("output {0}", obj.Foo(10, 70));


---

Original Source: https://www.mindstick.com/forum/1969/how-to-call-reflection-method

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
