コード例 #1
0
ファイル: MultiListBox.cs プロジェクト: goodjob-666/rubbish
        /// <summary>
        ///
        /// </summary>
        /// <param name="items"></param>
        /// <param name="methodName"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static object InvokeMethod(ListItemCollection items, string methodName, object[] parameters)
        {
            Type      type      = items.GetType();
            FieldInfo fieldInfo = type.GetField("saveAll", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Default);

            fieldInfo.SetValue(items, (object)true);//
            MethodInfo methodInfo = type.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Default | BindingFlags.Instance | BindingFlags.IgnoreCase);

            if (methodInfo != null)
            {
                return(methodInfo.Invoke(items, parameters));
            }
            return(null);
        }