Guest User

Untitled

a guest
May 24th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. public class Example
  2. {
  3. public int Id { get; set; }
  4. public string Property1{ get; set; }
  5. public string Property2{ get; set; }
  6. }
  7.  
  8. public List<Example> TestingCallFromSeparateConsoleApp()
  9. {
  10. List<Example> exampleList = new List<Example>();
  11.  
  12. exampleList.Add(new Example
  13. {
  14. Id = 1,
  15. Property1 = "First",
  16. Property2 = "First",
  17. });
  18.  
  19. exampleList.Add(new Example
  20. {
  21. Id = 2,
  22. Property1 = "Second",
  23. Property2 = "Second",
  24. });
  25.  
  26. return exampleList;
  27. }
  28.  
  29. asm = Assembly.LoadFrom(assemblyFile);
  30. var smsAppInstance = asm.CreateInstance("EngineeringAssistantMVC.Controllers.TestController", false, BindingFlags.CreateInstance, null, null, null, null);
  31.  
  32. var ExampleClass = asm.GetType("EngineeringAssistant.Controllers.Example", true);
  33. var ec = ExampleClass.GetType();
  34.  
  35. ExampleClass newExampleClass = new ExampleClass();
  36.  
  37. var result = smsAppInstance.GetType().GetMethod("TestingCallFromSeparateConsoleApp").Invoke(smsAppInstance, argumentsTopass);
  38.  
  39. Right click project -> Add -> Reference
Add Comment
Please, Sign In to add comment