Ejemplo n.º 1
0
        public MyDelegate(MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }
            _listOfMethods = new List <MethodInfo> {
                method
            };
            _signatureOfFunction = new ParametersAndType(method.GetParameters(), method.ReturnType);

            Exceptions = new List <Exception>();
        }
Ejemplo n.º 2
0
        public void AddMethod(MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentNullException(nameof(method));
            }
            if (_listOfMethods.Count == 0)
            {
                _listOfMethods       = new List <MethodInfo>();
                _signatureOfFunction = new ParametersAndType(method.GetParameters(), method.ReturnType);
            }
            if (method.ReturnType != _signatureOfFunction.ReturnType ||
                !ParametersInfoEquality(method.GetParameters(), _signatureOfFunction.Parameters))
            {
                throw new InvalidOperationException("Сигнатуры функций не совпадают");
            }

            _listOfMethods.Add(method);
        }