public static void CallBundleMethods(this IMvxViewModel viewModel, string methodName, IMvxBundle bundle) { var methods = viewModel .GetType() .GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy) .Where(m => m.Name == methodName && !m.IsAbstract); foreach (var methodInfo in methods) { viewModel.CallBundleMethod(methodInfo, bundle); } }
public static void CallBundleMethods(this IMvxViewModel viewModel, string methodName, IMvxBundle?bundle) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } var methods = viewModel .GetType() .GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy) .Where(m => m.Name == methodName && !m.IsAbstract); foreach (var methodInfo in methods) { viewModel.CallBundleMethod(methodInfo, bundle); } }