ReflectionHelper.cs 566 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Reflection;
  6. namespace Bowin.Common.Utility
  7. {
  8. public class ReflectionHelper
  9. {
  10. public static object CreateByFullName(string classFullName)
  11. {
  12. try
  13. {
  14. string[] classNames = classFullName.Split(',');
  15. return Assembly.Load(classNames[1]).CreateInstance(classNames[0]);
  16. }
  17. catch (Exception ex)
  18. {
  19. return null;
  20. }
  21. }
  22. }
  23. }