Exemplo n.º 1
0
        /// <summary>Dynamic method call.</summary>
        /// <param name = "name">A method name, e.g. "setFrame:display:".</param>
        /// <param name = "args">The arguments to pass to the method. If the arity or argument types
        /// don't match the unmanaged code an exception will be thrown.</param>
        public object Call(string name, params object[] args)
        {
            Contract.Requires(name != null, "name is null");
            Contract.Requires(!m_deallocated, "ref count is zero");

            object result;

            if (m_instance != IntPtr.Zero)
            {
                result = Native.Call(m_instance, name, args);
            }
            else
            {
                result = new NSObject(IntPtr.Zero);
            }

            return(result);
        }